问题
document.getElementById('grand_total_display).innerHTML = "Total is : $"+variable;
is displaying error in IE6 and IE7
I have an <li>
with id as grand_total_display with some text displayed in it.
<li class="bannerprice" id="grand_total_display">TOTAL PRICE : $0</li>
I am executing a jjavascript function to insert some other value into it.. but I am displayed with the error as given below:

Please help me to rectify the issue
回答1:
Apparently there's no element in the DOM with 'totaldisplay' as its id, or, as galambalazs suggests, you might have multiple elements with the same id.
With IE7 you can use "Internet Explorer Developer Toolbar" and "Web Development Helper" plugin, to find the problem.
回答2:
You have the wrong ID:
variable = "howdy";
document.getElementById('grand_total_display').innerHTML = "Total is : $"+variable;
instead of
variable = "howdy";
document.getElementById('totaldisplay').innerHTML = "Total is : $"+variable;
回答3:
Make sure that your <script>
is after the element #totaldisplay
(also that the id is unique on your page).
来源:https://stackoverflow.com/questions/3890659/document-getelementbyidgrand-total-display-innerhtml-total-is-variab