JavaScript - Use Of Getattributenodens() Is Deprecated. Use Getattributens() Instead.
hello. A simple example:
Code: <!DOCTYPE html> <html> <head> <title>blank</title> <meta charset="UTF-8"> </head> <body> <style> .hide{ display:none; } </style> <input type="button" value="show div 1" onclick="showDiv('div1')"> <div class="hide" id="div1">Hi there!</div> <script type="text/javascript"> function showDiv(divID){ document.getElementById(divID).style.display="block"; } </script> </body> </html> I have been using this technique for a while, but my version of firefox just updated itself and now it pops a warning that: "Use of getAttributeNodeNS() is deprecated. Use getAttributeNS() instead." I've googled and I can't make head or tail of what I'm supposed to be doing. Can somebody show me how the above code "should" be? Similar TutorialsHi Is the following code deprecated? Actually I was trying to create a drop-down list with values 1,2,3,...,9 in it & I got this code from net. But I can't understand the code properly. Code: <script> function addOption(selectbox,text,value ) { var optn = document.createElement("option"); optn.text = text; optn.value = value; selectbox.options.add(optn); } function addOption_list(selectbox){ var a=new Array("1","2","3","4","5","6","7","8","9"); for (var i=0; i < a.length;++i){ addOption(document.drop_list.a_list, a[i], a[i]); } } </script> 1)Also I don't understand what the "options" in the code Code: selectbox.options.add(optn); mean? There is no mention of an "options" array . 2)Also what is the Code: add(optn) does? What is the "optn" mean here? 3)What is the value of 'selectbox'? Where from is it passed to the function? I am something of a javascript noob - I write mostly PHP and don't do a lot in javascript. Anyway, I Googled what I wanted to do and found an example that uses window.onload = function() { ... whatever ... } which seems to work fine, but the brower's error console tells me that the use of captureEvents (which I presume includes window.onload()) is deprecated and that I should use addEventListener instead. I've had a look on google for examples of addEventListener for the equivalent of document.onload and although I understand the difference and I see how both mechanisms work, I'm struggling to understand why one is better than the other? Please enlighten me! |