IE7 - "Remembering" Javascript variables
Posted: Wed Oct 22, 2008 3:21 pm
I have been having an issue with basic row highlighting in IE7.
each tr has this line set through PHP
the page has a hidden form variable
I find this to be straightforward. No problems with FF3 but in IE7. Once I load the page and click to highlight any row, there is no problems. If I navigate away and back to the page (or click on another page within the site) it seems to remember and rehighlight. Now a Javascript alert shows it isn't stored at the end of the script tag, but it may be something internal.
On another note, it seems javascript might be caching some ajax code I have done as well.
Could this be a setting in my IE locally or is there something with IE7? (I don't currently have easy access to IE6 to verify)
Code: Select all
<script> var dt = document.getElementById('mytable'); var dtRows = document.getElementById('mytable').getElementsByTagName('tr'); function highlightSelected(){ //loop through entire table and remove highlighting id = document.getElementById('myid').value; for(var i=0;i<dt.rows.length;i++){ dt.rows[i].style.backgroundColor= (i%2==0) ? '#c5c5c5' : '#eeeeee'; } //get the selected row and highlight if(id!=0){document.getElementById(id).style.backgroundColor='red';} } highlightSelected();</script>Code: Select all
<tr id='$rowID' onclick='setSelected($rowID);'>Code: Select all
<input type='hidden' name='myid' id='myid' value='0'>On another note, it seems javascript might be caching some ajax code I have done as well.
Could this be a setting in my IE locally or is there something with IE7? (I don't currently have easy access to IE6 to verify)