SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: "for in" loop producing FF error
Hybrid View
-
Aug 14, 2007, 07:12 #1
- Join Date
- Sep 2006
- Posts
- 19
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
"for in" loop producing FF error
Can anyone shed some light on why this is producing an error in FF.
Code:<input type="button" name="my_btn" value="Click Here" onclick="for(var j in this) { alert(j + ' : ' + this[j]); }" />
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLInputElement.selectionStart]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost/error.html :: onclick :: line 1" data: no]PHP MySQL Shopping Cart
www.eprocart.com
-
Aug 14, 2007, 07:38 #2
- Join Date
- Oct 2004
- Location
- Birtley, UK
- Posts
- 2,439
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
shouldn't it be, foreach(j in this)
-
Aug 14, 2007, 12:03 #3
- Join Date
- Sep 2006
- Posts
- 19
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I'm not sure but is foreach a javascript function?
PHP MySQL Shopping Cart
www.eprocart.com
-
Aug 14, 2007, 12:23 #4
- Join Date
- Oct 2004
- Location
- Birtley, UK
- Posts
- 2,439
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Sorry I completely misunderstood the question. It seems that your trying to read a property that cannot be read basically. Using try{} catch(e){} you can stop errors from appearing.
Also, why are you doing this?
Bookmarks