JavaScript - Setattribute() And Ie6
Having some issues with setAttribute() and IE6, works in other browsers just being illusive in IE6.
Any help here would be great. Currently using IETester v0.4.6. Stylez. Code: <div id="Element">Element</div> <script> document.getElementById("Element").setAttribute('onclick', 'alert("!")'); </script> Similar TutorialsCode: closeElement.setAttribute('onClick', 'killElement()'); is not working in IE but works in mozilla browsers what is the appropriate IE version for the similar code? i've also tried: Code: closeElement.onclick = 'killElement()'; Hi, How can I set textarea setAttribute value in FireFox. When I print my form it doesn't print any thing inside FireFox. It prints it blank. Code: var AddlInfo= IntakeForm.getElementsByTagName('textarea')[0]; AddlInfo.setAttribute("value",AddlInfo.value); Thanks. Everything works but I'm afraid that it might be slow due to my heavy use of setAttribute for my dynamically created buttons. This is the only place I've needed it because I was able to use this bit of code Old Pedant came up with. Here's what I'm trying to improve upon Code: span.setAttribute("onMouseOver","ShowPage(type_num,\"all\",1);ShowPage(type_num,\"y"+z+"\",1);"); Quote: Originally Posted by Old Pedant Code: xxx.setAttribute("itemnum",itemnum); xxx.onclick = function() { return showRapidText(this.getAttribute("itemnum")); }; I don't understand how to apply that ^ to this > Code: span.setAttribute("onMouseOver","ShowPage(type_num,\"all\",1);ShowPage(type_num,\"y"+z+"\",1);"); My working version is here ... and the next bit is what I've tried and had no success with. Code: for (z=1920; z<=2010;z++){ var li = document.getElementById("Dynamic_Year_Filter_Reference"); var span = document.createElement("SPAN"); var text = document.createTextNode(z); span.id = "y"+z+"_mainmenuimg" span.className = "mainmenuimgyear" span.setAttribute("onMouseOver","ShowPage(type_num,\"all\",1);ShowPage(type_num,\"y"+z+"\",1);"); span.setAttribute("onMouseDown","l_num=\"y"+z+"\";pg_num=1;ShowPage(type_num,l_num,pg_num);"); span.setAttribute("onMouseOut","ShowPage(type_num,l_num,pg_num);"); li.appendChild(span).appendChild(text) } } Code: span.setAttribute("type_num", type_num); span.onmouseover = function() { ShowPage(this.getAttribute("type_num"),"all",1);ShowPage(this.getAttribute("type_num"),"y"+z+"",1); }; Im writing a piece of javascript that dynamically adds a link to a page, this is the code i'm using Code: var newP; newP = document.createElement("a"); newP.innerHTML = "Click here"; newP.setAttribute("href","http://mywebsite.com/link.html"); var p2 = document.getElementById("Div1"); p2.parentNode.insertBefore(newP,p2); However, it wont work?!?! the link appears in the right place on the page when i remove the line Code: newP.setAttribute("href","http://mywebsite.com/link.html"); and if i view the source the link is <a>Click here</a> (without any href) so there's got to be something wrong with that line but i don't know what it is. Can anyone help me? How do i add a href to the anchor?? I'm using firefox. |