JavaScript - Getting Ie7 To Dynamically Create An Image
Hi,
I have the following function to dynamically create an image (in this case a toolbox button): Code: function createButton(srcid,bttn) { if (bttn=='mag') {s='Magnify';h='Magnify';o='DoZoom(event,\'0\',\''+srcid+'\')';} if (bttn=='frz') {s='Pause';h='Freeze/Unfreeze';o='setPicture(\''+srcid+'\',0)';} if (bttn=='swp') {s='Swap';h='Swap maps';o='setPicture(\''+srcid+'\',2)';} btn=document.createElement('img'); btn.setAttribute('src','toolbox/'+s+'.gif'); btn.setAttribute('width','16px'); btn.setAttribute('height','16px'); btn.setAttribute('id',bttn+'btn_'+srcid); btn.setAttribute('class','button'); btn.setAttribute('name','Toolbox'); btn.setAttribute('title',h); btn.setAttribute('onclick',o); document.getElementById('ctrlDiv').appendChild(btn); } which works fine in IE8 and IE9, but in IE7 it refuses to pick up the style 'button'. I've even tried putting in btn.class='button' but JS throws up an error. If I specify the style by btn.style.position='Absolute' it picks this up OK. However, it won't respond to the onclick event either. I have heard that setAttribute is buggy with IE7, which is why I tried to specify each attribute directly. The style sheet for class button is: Code: .button { position: absolute; left: 5; top: 5; z-index: 1; } (BTW, no link to a website as this is local on my machine atm) TIA, Gerald. Similar TutorialsHow do I dynamically create a <select> with <options> in Javascript?
Can someone see what is wrong with this code: Code: frm=document.createElement('form') frm.action="/cgi-sys/formmail.pl" frm.method="POST" fld=document.createElement('textarea') fld.appendChild(document.createTextNode(simpleCart.items)) frm.appendChild(fld) It is supposed to dynamically create a textarea and fill it up with the return of simpleCart.items() Let's say I would want to create a custom object with properties. The properties would get their values from text input fields. The only thing that I can't get is how to assign variables to the new instances of the object.Here's my go at it: //First create object prototype function Obj(prop1,prop2,prop3) { this.prop1=prop1; this.prop2=prop2; this.prop3=prop3; this.showProps=showProps; //This method will show all props } //Array for storing each object instance var Objects=new Array(),i=-1; //---Now the HTML code <form name="myform" onSubmit="Objects[i++]=new Obj(text1.value,text2.value,text3.value)"> <b>Age:</b><input name="text1"> <b>Sex:</b><input name="text2"> <b>Location:</b><input name="text3"> <input type="submit"> </form> Ok,so knowing that each array element can store anything,including another object I used an Array to store each object instance.But is there any other way of storing objects? like in variables. Hi, I have written a code below: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <script type="text/javascript"> function emailRowContent(isSelected, emailAddress, severity) { var emailRowObj = document.getElementById('emailRow'); emailRowObj.childNodes[1].childNodes[0].checked = isSelected; emailRowObj.childNodes[3].childNodes[0].value = emailAddress; emailRowObj.childNodes[5].childNodes[0].checked = severity; } function LoadUp() { var emailAddressListObj = document.getElementById('emailAddressList'); var arrayOfEmails = new Array(5); for (i = 0; i < 5; i++) { arrayOfEmails[i] = new emailRowContent( "checked", "fjkum@unknown.com" + i, i ); //emailAddressListObj.appendChild( arrayOfEmails[i] ); /* Somehow this line breaks */ } } </script> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body onload="javascript:LoadUp();"> <div id="emailRow" class="emailRowClass"> <div><input type="checkbox" class="checkbox1"></div> <div><input type="text" class="textfield"></div> <div><input type="checkbox" class="checkbox2"></div> </div> <div id="emailAddressList" class="emailAddressClass"></div> </body> </html> Basically, what I want to do is to dynamically create 5 instances of "emailRow" onto the web page making use of Javascript DOM. But have no success in getting it to work. Can anyone shed some light? Mike Hi there, so i am working on a website, and on it there is a video with youtube api. I need to hide all Table-rows that are not during each 5 second time frame. So for example, when it is at 0:36, it will hide all TR's besides the TR that has to do with the video between 0:35 and 0:40. Each TR displays a start time, content, and end time. Here is what the tables currently look like. Code: <table width="600" class="table" > <tr class="item-titles"> <td width="75" class="none">Start</td> <td width="400">Caption</td> <td width="75">End</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(0, false)">0</a></td> <td><a href="javascript:player.seekTo(0, false)"></a></td> <td><a href="javascript:player.seekTo(5, false)">5</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(5, false)">5</a></td> <td><a href="javascript:player.seekTo(5, false)"></a></td> <td><a href="javascript:player.seekTo(10, false)">10</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(10, false)">10</a></td> <td><a href="javascript:player.seekTo(10, false)"></a></td> <td><a href="javascript:player.seekTo(15, false)">15</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(15, false)">15</a></td> <td><a href="javascript:player.seekTo(15, false)"></a></td> <td><a href="javascript:player.seekTo(20, false)">20</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(20, false)">20</a></td> <td><a href="javascript:player.seekTo(20, false)"></a></td> <td><a href="javascript:player.seekTo(25, false)">25</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(25, false)">25</a></td> <td><a href="javascript:player.seekTo(25, false)"></a></td> <td><a href="javascript:player.seekTo(30, false)">30</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(30, false)">30</a></td> <td><a href="javascript:player.seekTo(30, false)"></a></td> <td><a href="javascript:player.seekTo(35, false)">35</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(35, false)">35</a></td> <td><a href="javascript:player.seekTo(35, false)"></a></td> <td><a href="javascript:player.seekTo(40, false)">40</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(40, false)">40</a></td> <td><a href="javascript:player.seekTo(40, false)"></a></td> <td><a href="javascript:player.seekTo(45, false)">45</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(45, false)">45</a></td> <td><a href="javascript:player.seekTo(45, false)"></a></td> <td><a href="javascript:player.seekTo(50, false)">50</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(50, false)">50</a></td> <td><a href="javascript:player.seekTo(50, false)"></a></td> <td><a href="javascript:player.seekTo(55, false)">55</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(55, false)">55</a></td> <td><a href="javascript:player.seekTo(55, false)"></a></td> <td><a href="javascript:player.seekTo(60, false)">60</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(60, false)">60</a></td> <td><a href="javascript:player.seekTo(60, false)"></a></td> <td><a href="javascript:player.seekTo(65, false)">65</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(65, false)">65</a></td> <td><a href="javascript:player.seekTo(65, false)"></a></td> <td><a href="javascript:player.seekTo(70, false)">70</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(70, false)">70</a></td> <td><a href="javascript:player.seekTo(70, false)"></a></td> <td><a href="javascript:player.seekTo(75, false)">75</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(75, false)">75</a></td> <td><a href="javascript:player.seekTo(75, false)"></a></td> <td><a href="javascript:player.seekTo(80, false)">80</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(80, false)">80</a></td> <td><a href="javascript:player.seekTo(80, false)"></a></td> <td><a href="javascript:player.seekTo(85, false)">85</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(85, false)">85</a></td> <td><a href="javascript:player.seekTo(85, false)"></a></td> <td><a href="javascript:player.seekTo(90, false)">90</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(90, false)">90</a></td> <td><a href="javascript:player.seekTo(90, false)"></a></td> <td><a href="javascript:player.seekTo(95, false)">95</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(95, false)">95</a></td> <td><a href="javascript:player.seekTo(95, false)"></a></td> <td><a href="javascript:player.seekTo(100, false)">100</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(100, false)">100</a></td> <td><a href="javascript:player.seekTo(100, false)"></a></td> <td><a href="javascript:player.seekTo(105, false)">105</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(105, false)">105</a></td> <td><a href="javascript:player.seekTo(105, false)"></a></td> <td><a href="javascript:player.seekTo(110, false)">110</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(110, false)">110</a></td> <td><a href="javascript:player.seekTo(110, false)"></a></td> <td><a href="javascript:player.seekTo(115, false)">115</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(115, false)">115</a></td> <td><a href="javascript:player.seekTo(115, false)"></a></td> <td><a href="javascript:player.seekTo(120, false)">120</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(120, false)">120</a></td> <td><a href="javascript:player.seekTo(120, false)"></a></td> <td><a href="javascript:player.seekTo(125, false)">125</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(125, false)">125</a></td> <td><a href="javascript:player.seekTo(125, false)"></a></td> <td><a href="javascript:player.seekTo(130, false)">130</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(130, false)">130</a></td> <td><a href="javascript:player.seekTo(130, false)"></a></td> <td><a href="javascript:player.seekTo(135, false)">135</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(135, false)">135</a></td> <td><a href="javascript:player.seekTo(135, false)"></a></td> <td><a href="javascript:player.seekTo(140, false)">140</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(140, false)">140</a></td> <td><a href="javascript:player.seekTo(140, false)"></a></td> <td><a href="javascript:player.seekTo(145, false)">145</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(145, false)">145</a></td> <td><a href="javascript:player.seekTo(145, false)"></a></td> <td><a href="javascript:player.seekTo(150, false)">150</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(150, false)">150</a></td> <td><a href="javascript:player.seekTo(150, false)"></a></td> <td><a href="javascript:player.seekTo(155, false)">155</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(155, false)">155</a></td> <td><a href="javascript:player.seekTo(155, false)"></a></td> <td><a href="javascript:player.seekTo(160, false)">160</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(160, false)">160</a></td> <td><a href="javascript:player.seekTo(160, false)"></a></td> <td><a href="javascript:player.seekTo(165, false)">165</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(165, false)">165</a></td> <td><a href="javascript:player.seekTo(165, false)"></a></td> <td><a href="javascript:player.seekTo(170, false)">170</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(170, false)">170</a></td> <td><a href="javascript:player.seekTo(170, false)"></a></td> <td><a href="javascript:player.seekTo(175, false)">175</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(175, false)">175</a></td> <td><a href="javascript:player.seekTo(175, false)"></a></td> <td><a href="javascript:player.seekTo(180, false)">180</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(180, false)">180</a></td> <td><a href="javascript:player.seekTo(180, false)"></a></td> <td><a href="javascript:player.seekTo(185, false)">185</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(185, false)">185</a></td> <td><a href="javascript:player.seekTo(185, false)"></a></td> <td><a href="javascript:player.seekTo(190, false)">190</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(190, false)">190</a></td> <td><a href="javascript:player.seekTo(190, false)"></a></td> <td><a href="javascript:player.seekTo(195, false)">195</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(195, false)">195</a></td> <td><a href="javascript:player.seekTo(195, false)"></a></td> <td><a href="javascript:player.seekTo(200, false)">200</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(200, false)">200</a></td> <td><a href="javascript:player.seekTo(200, false)"></a></td> <td><a href="javascript:player.seekTo(205, false)">205</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(205, false)">205</a></td> <td><a href="javascript:player.seekTo(205, false)"></a></td> <td><a href="javascript:player.seekTo(210, false)">210</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(210, false)">210</a></td> <td><a href="javascript:player.seekTo(210, false)"></a></td> <td><a href="javascript:player.seekTo(215, false)">215</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(215, false)">215</a></td> <td><a href="javascript:player.seekTo(215, false)"></a></td> <td><a href="javascript:player.seekTo(220, false)">220</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(220, false)">220</a></td> <td><a href="javascript:player.seekTo(220, false)"></a></td> <td><a href="javascript:player.seekTo(225, false)">225</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(225, false)">225</a></td> <td><a href="javascript:player.seekTo(225, false)"></a></td> <td><a href="javascript:player.seekTo(230, false)">230</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(230, false)">230</a></td> <td><a href="javascript:player.seekTo(230, false)"></a></td> <td><a href="javascript:player.seekTo(235, false)">235</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(235, false)">235</a></td> <td><a href="javascript:player.seekTo(235, false)"></a></td> <td><a href="javascript:player.seekTo(240, false)">240</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(240, false)">240</a></td> <td><a href="javascript:player.seekTo(240, false)"></a></td> <td><a href="javascript:player.seekTo(245, false)">245</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(245, false)">245</a></td> <td><a href="javascript:player.seekTo(245, false)"></a></td> <td><a href="javascript:player.seekTo(250, false)">250</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(250, false)">250</a></td> <td><a href="javascript:player.seekTo(250, false)"></a></td> <td><a href="javascript:player.seekTo(255, false)">255</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(255, false)">255</a></td> <td><a href="javascript:player.seekTo(255, false)"></a></td> <td><a href="javascript:player.seekTo(260, false)">260</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(260, false)">260</a></td> <td><a href="javascript:player.seekTo(260, false)"></a></td> <td><a href="javascript:player.seekTo(265, false)">265</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(265, false)">265</a></td> <td><a href="javascript:player.seekTo(265, false)"></a></td> <td><a href="javascript:player.seekTo(270, false)">270</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(270, false)">270</a></td> <td><a href="javascript:player.seekTo(270, false)"></a></td> <td><a href="javascript:player.seekTo(275, false)">275</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(275, false)">275</a></td> <td><a href="javascript:player.seekTo(275, false)"></a></td> <td><a href="javascript:player.seekTo(280, false)">280</td> </tr> <tr> <td class="none"><a href="javascript:player.seekTo(280, false)">280</a></td> <td><a href="javascript:player.seekTo(280, false)"></a></td> <td><a href="javascript:player.seekTo(285, false)">285</td> </tr> </table> And you can see the page at http://134.117.226.43:8000/check_sub...ty/test101/91/ any help ? I currently have a page which, when the user clicks a button creates a new row displaying a form. I also have other forms on this page however so I was wondering if anyone knew how to close a form using javascript? Thanks for any help. My code to create the table row and form are below... Code: myform = document.createElement("form"); myform.method = "post"; myform.action = "editdetails.php"; myform.id = "editemail"; myform.name = "editemail"; var a=document.getElementById('editdetailstable').insertRow(2); var b=document.getElementById('editdetailstable').insertRow(3); var x=a.insertCell(0); x.innerHTML="New Email: "; x.align = "right"; var y=a.insertCell(1); y.innerHTML="<input type='text' name='email' id='email' />"; var z=b.insertCell(0); z.innerHTML="<input type='button' value='Change' />" z.colSpan = "2"; z.align = "center"; Hello all, I am doing a website project and in that currently I am designing a product page. I have to design add values to text boxes and drag and drop the text boxes in the workspace and delete the text boxes the user does not want and have to draw a graphical line between the text boxes which are in order. I have designed and coded everything except the graphical line part. I am a learner in javascript and Can we draw a graphical line dynamically between the text boxes in the webpage? If we can draw, can anyone let me know the tutorial for that so that I can learn and start coding as I have to submit that project soon. Thank you. I am creating a website and there is an option for the user (after he login to the website, he enters into his workspace page)to upload a background image of his choice to his workspace page. Can the user dynamically upload a background image to his webpage? Can this be done in javascript/php? I would be glad if somebody could help me. Hi CodingForum! For my website, I have a working script that changes the background image of my website every time it is reloaded. However, I would also like the image to dynamically resize as the user resizes the browser window. here is a code snippet: Code: <head> <script type="text/JavaScript"> /*<![CDATA[*/var el="bgImg";var bgimg=new Array("../00home/06home.jpg","../00home/07home.jpg");var random=Math.round((bgimg.length-1)*Math.random());var cssStr="#"+el+" { background: url("+bgimg[random]+") no-repeat center } ";var style=document.createElement("style");style.setAttribute("type","text/css");if(style.styleSheet){style.styleSheet.cssText=cssStr;}else{var cssText=document.createTextNode(cssStr);style.appendChild(cssText);}document.getElementsByTagName("head")[0].appendChild(style);/*]]>*/ </script> <style type="text/css"> .rotatebg { z-index:0; position:fixed; top:0; left:0; width:1378px; height:1178px; background-repeat: no-repeat; background-position:inherit; overflow:hidden; } </style> </head <body> <div class="rotatebg" id="bgImg" style="width:100%; height:100%" ></div> </body> Does anyone know how I can augment/alter this coded setup to enable the randomly loaded background image to proportionately fill the browser window? http://www.javascriptkit.com/javatut...rnalphp2.shtml Anyone have a decent way of adding a fade affect to this script? I have search for about a week and still no luck. I need to dynamically display mutliple images using javascript, no hardcoding. The images have different categories. For ex. bellTower01.jpg, bellTower02.jpg...and fountain01.jpg, fountain02.jpg.... -Use JavaScript to display several images and scroll through them To display multiple thumbnails, arrange them into a small quantity (no more than 8 per page) Provide pagination I really really really need help. I have never done javascript before, so I'm still learning. I seriously checked out many threads and links but nothing works or is what I want. I hope someone can help me out and hopefully also allow me to become better at coding this kind of stuff. I am not allowed to code in php for this project. I can only use javascript to display the images. Also, I don't really need anything fancy, like slideshows or rotations, I just the image to appear when I select that specific category. I want to get the images from my folder/directory. Right now, I have it working as it just being hardcoded. Below is my code for my galleries page: <?php //creates a session..initializes session data session_start (); echo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Scenes of Purdue</title> <!-- Styling of the Webpage --> <link rel="stylesheet" type="text/css" href="css/style.css"/> <script src="js/prototype.js" type="text/javascript"></script> <script src="js/scriptaculous.js?load=effects,builder" type="text/javascript"></script> <script src="js/lightbox.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="css/lightbox.css"/> </head> <body> <div id="shadowContainer"> <div id="mainContainer"> <div id="mainHeader"></div> <div id="topNav"> <ul> <li><a href="index.php">Home</a></li> <li><a href="galleries.php">Galleries</a></li> </ul> </div><div id="content"> <br /> <div class="clearfix"><h1>Select a Category to View</h1> <br /> <div class="paginationBar" id="paginationBar"> <select id="catDropDown" onchange="javascript:getCategory()"> <option value="-" selected="selected">Select a Category</option> <option value="bellTower">Bell Tower</option> <option value="fountain">Fountain</option> </select> </div> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /> <ul id="pagination"> </ul> <div id="r1c1"></div> <div id="r1c2"></div> <div id="r1c3"></div> <div id="r2c1"></div> <div id="r2c2"></div> <div id="r2c3"></div> <script type="text/javascript"><!-- var bellTowerArray = new Array(); bellTowerArray[0] = "bellTower01.jpg"; bellTowerArray[1] = "bellTower02.jpg"; bellTowerArray[2] = "bellTower03.jpg"; bellTowerArray[3] = "bellTower04.jpg"; bellTowerArray[4] = "bellTower05.jpg"; bellTowerArray[5] = "bellTower06.jpg"; bellTowerArray[6] = "bellTower07.jpg"; bellTowerArray[7] = "bellTower08.jpg"; bellTowerArray[8] = "bellTower09.jpg"; bellTowerArray[9] = "bellTower10.jpg"; bellTowerArray[10] = "bellTower11.jpg"; bellTowerArray[11] = "bellTower12.jpg"; bellTowerArray[12] = "bellTower13.jpg"; bellTowerArray[13] = "bellTower14.jpg"; bellTowerArray[14] = "bellTower15.jpg"; bellTowerArray[15] = "bellTower16.jpg"; var fountainArray = new Array(); fountainArray[0] = "fountain01.jpg"; fountainArray[1] = "fountain02.jpg"; fountainArray[2] = "fountain03.jpg"; fountainArray[3] = "fountain04.jpg"; fountainArray[4] = "fountain05.jpg"; fountainArray[5] = "fountain06.jpg"; fountainArray[6] = "fountain07.jpg"; fountainArray[7] = "fountain08.jpg"; fountainArray[8] = "fountain09.jpg"; fountainArray[9] = "fountain10.jpg"; fountainArray[10] = "fountain11.jpg"; fountainArray[11] = "fountain12.jpg"; fountainArray[12] = "fountain13.jpg"; fountainArray[13] = "fountain14.jpg"; fountainArray[14] = "fountain15.jpg"; fountainArray[15] = "fountain16.jpg"; fountainArray[16] = "fountain17.jpg"; fountainArray[17] = "fountain18.jpg"; var currentArray = new Array(); function getCategory() { if(document.getElementById("catDropDown").selectedIndex == 1) { currentArray = bellTowerArray; } else if(document.getElementById("catDropDown").selectedIndex == 2) { currentArray = fountainArray; }//if/else if(document.getElementById("catDropDown").selectedIndex > 0) { displayImages(0); doPagination(); } } function displayImages(start) { //r1c1 if(!(start > currentArray.length-1)) document.getElementById("r1c1").innerHTML = "<a id=\"r1c1_a\" href=\"images/regular/" + currentArray[start] + "\" rel=\"lightbox\" title=\"This is the static description\"><img src=\"images/th/thumb_" + currentArray[start] + "\" id=\"r1c1_img\" width=\"150\" height=\"150\" alt=\"This is the static description in alt\" title=\"Static title description\" /><"+"/a>"; else document.getElementById("r1c1").innerHTML = ""; //r1c2 if(!(start+1 > currentArray.length-1)) document.getElementById("r1c2").innerHTML = "<a id=\"r1c2_a\" href=\"images/regular/" + currentArray[start+1] + "\" rel=\"lightbox\" title=\"This is the static description\"><img src=\"images/th/thumb_" + currentArray[start+1] + "\" id=\"r1c2_img\" width=\"150\" height=\"150\" alt=\"This is the static description in alt\" title=\"Static title description\" /><"+"/a>"; else document.getElementById("r1c2").innerHTML = ""; //r1c3 if(!(start+2 > currentArray.length-1)) document.getElementById("r1c3").innerHTML = "<a id=\"r1c3_a\" href=\"images/regular/" + currentArray[start+2] + "\" rel=\"lightbox\" title=\"This is the static description\"><img src=\"images/th/thumb_" + currentArray[start+2] + "\" id=\"r1c3_img\" width=\"150\" height=\"150\" alt=\"This is the static description in alt\" title=\"Static title description\" /><"+"/a>"; else document.getElementById("r1c3").innerHTML = ""; //r2c1 if(!(start+3 > currentArray.length-1)) document.getElementById("r2c1").innerHTML = "<a id=\"r2c1_a\" href=\"images/regular/" + currentArray[start+3] + "\" rel=\"lightbox\" title=\"This is the static description\"><img src=\"images/th/thumb_" + currentArray[start+3] + "\" id=\"r2c1_img\" width=\"150\" height=\"150\" alt=\"This is the static description in alt\" title=\"Static title description\" /><"+"/a>"; else document.getElementById("r2c1").innerHTML = ""; //r2c2 if(!(start+4 > currentArray.length-1)) document.getElementById("r2c2").innerHTML = "<a id=\"r2c2_a\" href=\"images/regular/" + currentArray[start+4] + "\" rel=\"lightbox\" title=\"This is the static description\"><img src=\"images/th/thumb_" + currentArray[start+4] + "\" id=\"r2c2_img\" width=\"150\" height=\"150\" alt=\"This is the static description in alt\" title=\"Static title description\" /><"+"/a>"; else document.getElementById("r2c2").innerHTML = ""; //r2c3 if(!(start+5 > currentArray.length-1)) document.getElementById("r2c3").innerHTML = "<a id=\"r2c3_a\" href=\"images/regular/" + currentArray[start+5] + "\" rel=\"lightbox\" title=\"This is the static description\"><img src=\"images/th/thumb_" + currentArray[start+5] + "\" id=\"r2c3_img\" width=\"150\" height=\"150\" alt=\"This is the static description in alt\" title=\"Static title description\" /><"+"/a>"; else document.getElementById("r2c3").innerHTML = ""; } function doPagination() { var numpages = (currentArray.length / 6) +1; var numleft = currentArray.length % 6; document.getElementById("pagination").innerHTML = ""; for(i=0; i<numpages-1; i++) { document.getElementById("pagination").innerHTML += "<span onclick='displayImages("+ i*6 +")'>"+ (i+1) + "<"+"/span> "; } if(numpages <=1) { document.getElementById("pagination").innerHTML = ""; } } document.getElementById("catDropDown").selectedIndex = 0; --> </script> </div> </div> </div> <div id="footer"><a href="readme.php">Readme</a><br /> <div class="clearfix"> <div style="float: left"><a href="adminLogin.php" title="Admin Login" class="adminLoginAjax">Admin login</a></div> </div> </div> </div> </div> </body> </html> Hi, I am in need of creating a image toolbox in a web browser using javascript. Please find the requirements below. 1) The toolbox will contain some images within it. The toolbox can be moved anywhere within the window. 2) It is possible to drag and drop a image clone from the toolbox to the window. 3) It should be possible to click on the image in the toolbox and can be placed when click on the window (at the clicked position). 4) on double clicking the image in the toolbox, the selected image should get cleared. Please provide suggestion as well as the code snippets to achieve the requirements. Kindly reply ASAP. Thanks, Vinoth.K Id like to create a rotating content for my homepage, using 4 images, all of which id like to be hyperlinked to there pages.
First off I'm incredibly new to JavaScript and its likely I am going about this completely the wrong way. But gotta start somewhere. Also my apologise if I am posting in the wrong area. Here's my problem. I have setup a site in CSS3/XHTML that I will use to display some of my photography (im a keen photographer) The way my Gallery will work will be using Submenu's then there will be a table of Thumbnails which I have setup. The part I am stuck on is that I want people to be able to click the thumbnails and then the corresponding picture held in the next folder to be displayed in a CSS defined container in the center of the page. So clicking _Images/Thumbnails/1.gif will bring up _/Images/1.gif in the CSS container For the life of me I cannot work out how to do it though. Here is my code so far. HTML -> <td> <a onclick="newImage" href="nogoto"> <img src="_images/Thumbnails/1.png" align="left" width="47px" height="33px" alt="1" id="1"/> </a> </td> CSS -> #mainpage { color:#FFF; text-align:right; font-size:.7em; height:365px; width:529px; position:relative; top:25px; left:35px; } JavaScript -> window.onload = newImage(); function newImage() { document.getElementById(mainpage).innerHTML = "<script>background-image:_images/1.png;</script>" } Obviously I want to expand on this once it works but for now I would just like to get the images to appear correctly when clicked. Thank you so much in Advance if anyone can help. Something similar to the navigation menu on http://www.gamewearteamsports.com/. You hover over a link and a box appears below that spreads the width of the menu itself. Friend of mine told me it was using actionscript but I have no idea how to create a drop down box (not menu). Any ideas? My friend told me Dreamweaver has the ability t create a drop down box but I have no idea. Also does anyone know how to create an image slider similar to the one on that site? A slider that fades from one image to the next with the navigation arrows on the left and right side and the dots on top left? Hi! I'm very new to Javascript so first I want to apologize for my lack of knowledge, what I'm asking is probably really simple to do. Im have a folder full of images. Each image is named with an incrementing number like vidseq000001, vidseq000002, vidseq000003 and so on. I'm trying to use a jQuery plugin called "reel" to make the sequence animate. For that it seems I need to put the images inside an array. I know how to manually enter each image inside the array like var [ vidseq000001, vidseq000002, vidseq000003, ] But this becomes quite tedious with over thousand images. What would be a smarter way to put all my images inside an array? ok i have a script which will make a copy of the html in a div and place it into another div the problem with this it creates a duplicate element with the same id so what i want to know is can i create a new id based off old ids using a generic type script Code: function scope(e) { var popin = document.getElementById('popin'); popin.innerHTML = "<div class='container'>"+e.innerHTML+"</div>"; popin.style.display = "block"; } this code is designed for taking content in a small div and placing it into a larger div to increase the viewing area so what i would need is sumthing that can look for Code: id="sum text" and maybe amend it to Code: id="sum textP" or sumthing to that extent if sum1 could point me in the right direction that would be great if my post is not clear enough just ask me to be more specific or sumthing and i will see what i can do to try and make it more clear if needed note: this is not homework Hi all, Currently I am doing this: Code: var e = document.getElementById('id'); e.style.color = '#ff0000'; e.style.fontFamily = 'sans-serif'; e.innerHTML = time; ...blah blah... What I'm actually doing is inserting the current time into an existing DIV and updating it every second. THAT all works. What I want to do is also set an event for that div.... something like this: e.event.onclick = 'runThisCode()'; Of course, the above doesn't work... and I'm not even sure what to ask for doing a Google search... because I get no hits (or maybe it's not possible). So, is it possible, and if so, how? Thanks! -- Roger p.s. I really don't want to edit the code itself (where that div is) because it's part of another app that may change as they update it and I don't want to have to re-patch every new release. Hi Guys, I am using the following bit of code to toggle information inside a webpage. Is there a way i can make this code more dynamic so that i do not have to use the next() function to initiate slidetoggle()? I would like to have it so i can pass an ID through to the function and it will then toggle my box but i can't figure it out. Javascript is not my strong suite. Here the function Code: function initMenu() { //$('.items_wrapper').hide();//object to be hidden $('.headline').click(//object to be clicked function() { $(this).next().slideToggle('slow'); //alert("doesn't work"); } ); } $(document).ready(function() {initMenu();}); I would like to create a link inside .headline such as .ViewItems If you need to see the code let me know and i will post it. --EDIT-- Right Now my code is like this and you click headline Code: <div class='headline'></div> <div class='items_wrapper'> </div> I would like it work with an internal element like this, so i can't use next() Code: <div class='headline'><div class='selector'>Click Here</div></div> <div class='items_wrapper'> </div> Thanks in advance. hello, I'm trying to load the ads on my site dynamically and have ran into an issue and was hoping for some help. First - I can get the ads to load using vanilla javascript with the code below. Code: var ifrm = document.createElement("iframe"); ifrm.setAttribute("src", OAS_url + "adstream_sx.ads/" +sitePage + "/" + uniqid() + "@" + pos); var ifrmId = "ifrm_" + uniqid(); ifrm.setAttribute("id", ifrmId); ifrm.setAttribute("marginwidth", 0); ifrm.setAttribute("marginheight", 0); ifrm.setAttribute("frameborder", 0); ifrm.setAttribute("scrolling", 0); ifrm.setAttribute("height", container.scrollHeight + (container.offsetHeight - container.clientHeight)); ifrm.setAttribute("width", container.scrollWidth + (container.offsetWidth - container.clientWidth)); container.appendChild(ifrm); But since the site is using jquery I wanted to develop it out that way. So I have the following code, Code: iRandom = oas.uniqid(); sAdURL = opt.url + 'adstream_mjx.ads/' + opt.sitepage + '/1' + iRandom + '@' + sPos + '?' + opt.query; $('<iframe />', { src: sAdURL, id: sPos }).appendTo(thisAd); I figured the reason this isn't working is the difference between appendChild and appendTo and the fact that things are jquery objects. So again the top code block renders the ads and the lower code block just shows the javascript code from the ad provider. Any help to get this to work in jquery would be grateful. Thanks |