javascript - Why is this div not responding to innerHTML when others on the page do? -


this question has answer here:

when using javascript set innerhtml of div have 1 div cannot figure out why not being set...

i have following code in <body> on page

<div style="width:50%; margin:0 auto;">     <div id="name"></div>     <div id="image"></div>     <div id="description"></div> </div> <script>     var url = window.location.href;     var captured = /name=([^&]+)/.exec(url)[1];     var result = decodeuri(captured);     if (result != 'none') {         var name = document.getelementbyid('name');         name.innerhtml = "<p>" + result + "</p>";         var description = document.getelementbyid('description');         description.innerhtml = '<object data="descriptions/' + result + '.txt" style="font-family:gotham, helvetica, arial, sans-serif"></object>'         var image = document.getelementbyid('image');         image.innerhtml = '<img style="float:left;" src="images/' + result + '.jpg">'     }     else {         document.write('you have no items in cart');         var elem = document.getelementbyid('badge');         elem.parentnode.removechild(elem);     } </script> 

for reason name <div> not modified when description , image divs do. there missing here?

the javascript console in safari , chrome shows no errors , both have same result. name variable not null.

also note school project, doesn't have practical means.

the name variable conflicts window.name. need change var name = var somethingelse =.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -