| | |
IE7 returning toJSON instead of i: javascript
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2009
Posts: 1
Reputation:
Solved Threads: 0
Hi all,
I'm not overly proficient at Javascript, but have fumbled my way through some tutorials to come up with the following code to create a tab mechanism.
It works perfectly in Firefox, Safari, Chrome and IE8. However, in IE6 and IE7 it fails to operate as of the 'for (var i in temp) {' line. It doesn't error out, it just doesn't perform any of the functions within the for.
Some things I've noted:
* In Firefox if I alert(i) below the for, then it alerts the numerical value of i correctly through the for loop.
* In IE7, however, alert(i) alerts the value 'toJSON' and nothing more. It never finds 'if (i <= maxlen) {' to be true as a result.
Any thoughts on what's going wrong here?
And I'm calling it with
I'm not overly proficient at Javascript, but have fumbled my way through some tutorials to come up with the following code to create a tab mechanism.
It works perfectly in Firefox, Safari, Chrome and IE8. However, in IE6 and IE7 it fails to operate as of the 'for (var i in temp) {' line. It doesn't error out, it just doesn't perform any of the functions within the for.
Some things I've noted:
* In Firefox if I alert(i) below the for, then it alerts the numerical value of i correctly through the for loop.
* In IE7, however, alert(i) alerts the value 'toJSON' and nothing more. It never finds 'if (i <= maxlen) {' to be true as a result.
Any thoughts on what's going wrong here?
javascript Syntax (Toggle Plain Text)
function toggle_visibility(showid, hideids) { $(showid).style.display = 'block'; // Change CSS var newcss = showid.split('_').join(''); $(newcss).setAttribute("class", "tabselected"); $(newcss).setAttribute("className", "tabselected"); if (hideids != '') { var temp = new Array(); temp = hideids.split(','); var maxlen = (temp.length - 1); var i = 0; for (var i in temp) { if (i <= maxlen) { if (temp[i] != showid) { $(temp[i]).style.display = 'none'; var newcss = temp[i].split('_').join(''); $(newcss).setAttribute("class", "tab2"); $(newcss).setAttribute("className", "tab2"); } } else { break; } } } }
And I'm calling it with
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
toggle_visibility('tab3', 'tab1,tab2');
![]() |
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: advertisement
- Next Thread: Setting Javascript Calendar to European Time Format
| Thread Tools | Search this Thread |
ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug calendar captchaformproblem checkbox child class close column createrange() css cursor debugger dependent disablefirebug dom download dropdown editor element embed engine error events explorer ext file form forms getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe images internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jump libcurl math media microsoft mimic object onmouseoutdivproblem onreadystatechange parent paypal pdf php player position post problem programming progressbar regex runtime scroll search security select session shopping size software sql text textarea unicode w3c web website window windowofwords windowsxp wysiwyg \n






