i use dom multiple class names , pass function(with_value) access individual elements. uncaught typeerror cannot read propperty 'innerhtml' of undefined. code is:
<script> var token = 1; var x = document.getelementsbyname("commpare_name"); var y = document.getelementsbyname("compare_image"); function add_compare(num) { num=0; var = x[num].innerhtml.touppercase(); alert(a); document.getelementbyid('name1').innerhtml = a; document.getelementbyid('name1').title = document.getelementbyid('pics1').src = x[num].src; = document.getelementbyid('view-details0').action; } </script> <span id="compare_name" name="compare_name" >no1</span> <form id="view-details0"> <input type="button" value="add compare" onclick="add_compare(1)"> </form> <span id="compare_name" name="compare_name" >no1</span> <form id="view-details0"> <input type="button" value="add compare" onclick="add_compare(2)"> </form>
edit:
<a class="description" id="name1" href="" target="_blank" title="add compare" ><span>add compare</span></a>
the innerhtml , thee href of needs change
you giving wrong name in script
commpare_name - > compare_name
Comments
Post a Comment