Hi! Does anyone knows how come setAtrribute doesn't work in ff only in ie? Is there any replacement for that? any other command? thanx a lot
really? in FF3.06 just now: <a href="#" id="foo">my link</a> <script language="JavaScript"> var foo = document.getElementById("foo"); alert(foo.getAttribute("rel")); // alerts null foo.setAttribute("rel", "nofollow"); alert(foo.getAttribute("rel")); // alerts 'nofollow' </script> PHP:
buy this is the code i wrote that workes well in ie and doesn't work in ff Please correct me.. 10x a lot!! <html> <head> <script type="text/javascript"> function regel() { var z=document.getElementById("t1"); var s=z.value document.getElementById("t2").value=s; z.setAttribute("value",""); } function megel() { var z=document.getElementById("t2"); var s=z.value document.getElementById("t1").value=s; z.setAttribute("value",""); } </script> </head> <body> <input type="text" id="t1" style="width:200px; height:200px;"> <input type="text" id="t2" style="width:200px; height:200px;"> <input type="button" value="right->>" onclick="regel()"> </button> <input type="button" value="<<-Left" onclick="megel()"> </button> </body> Code (markup):
According to the mozilla DOM reference ( https://developer.mozilla.org/en/DOM/element.setAttribute ) so you should better change your code to <script type="text/javascript"> function regel() { var z=document.getElementById("t1"); var s=z.value; document.getElementById("t2").value=s; z.value=""; } function megel() { var z=document.getElementById("t2"); var s=z.value; document.getElementById("t1").value=s; z.value=""; } </script> HTML: hope this helps..
interesting, gnp... thanks for that clarification, rep inbound once again -- sorry for misleading here - this is due to my excessive use of methods and frameworks - in mootools, all i'd do here is element.set("value", "blah"); and forget about it.