html - Javascript set Attribute -


i have problem. want set attributes js.

for(i=0;i<div_navi.childnodes.length;i++){                           if(div_navi.childnodes[i].nodename =="span"){         div_navi.childnodes[i].setattribute("onclick","getcontent(div_navi.childnodes[i].textcontent);          div_navi.childnodes[i].style.cursor ="pointer";     }     if(div_navi.childnodes[i].nodename =="a")         div_navi.childnodes[i].setattribute("href",div_navi.childnodes[i].textcontent);     } } 

i want set parameter in getcontent, doesn't work. has idea, how work?

use quotes , should bind event , can set href property instead directly.

div_navi.childnodes[i].onclick = function(){     getcontent(this.textcontent) }; div_navi.childnodes[i].href = div_navi.childnodes[i].textcontent; 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -