Javascript fix on website.
| From: | Curt Zirzow | Date: | Mon, 13 Oct 2003 14:32:38 +0000 |
| Subject: | Javascript fix on website. | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-21494@lists.php.net to get a copy of this message | ||
It seems that Opera 7.11 has some bugs using the javascript 'with'
statement, and all pages requested on the website cause undefined
object errors on line 71.
Attached is a fix for this. Basically I removed the 'with' statment
and just accessed the object in its full, in theory this should be
compatible with all browsers. I havn't been able to test it in
context of the site.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
Index: userprefs.js =================================================================== RCS file: /repository/phpweb/userprefs.js,v retrieving revision 1.8 diff -u -r1.8 userprefs.js --- userprefs.js 16 Sep 2003 16:21:37 -0000 1.8 +++ userprefs.js 12 Oct 2003 16:00:39 -0000 @@ -67,12 +67,10 @@ document.forms["topsearch"].pattern.value = pattern; // Set the last selected search method in the dropdown - with (document.forms["topsearch"]) { - for (var i = 0; i < show.length; i++) { - if (show[i].value == option) { - show[i].selected = true; - break; - } + for (var i = 0; i < document.forms["topsearch"].show.length; i++) { + if (document.forms["topsearch"].show[i].value == option) { + document.forms["topsearch"].show[i].selected = true; + break; } } }
Index: userprefs.js =================================================================== RCS file: /repository/phpweb/userprefs.js,v retrieving revision 1.8 diff -u -r1.8 userprefs.js --- userprefs.js 16 Sep 2003 16:21:37 -0000 1.8 +++ userprefs.js 12 Oct 2003 16:00:39 -0000 @@ -67,12 +67,10 @@ document.forms["topsearch"].pattern.value = pattern; // Set the last selected search method in the dropdown - with (document.forms["topsearch"]) { - for (var i = 0; i < show.length; i++) { - if (show[i].value == option) { - show[i].selected = true; - break; - } + for (var i = 0; i < document.forms["topsearch"].show.length; i++) { + if (document.forms["topsearch"].show[i].value == option) { + document.forms["topsearch"].show[i].selected = true; + break; } } }