Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Script yielding inconsistent results
Old 02-08-2009, 07:52 PM Script yielding inconsistent results
Junior Talker

Posts: 2
Name: Martin
Trades: 0
Code:
var arr = document.getElementsByTagName('iframe');
var i, len = arr.length;
for ( i = 0; i <= len; i++ ) {arr[i].parentNode.removeChild( arr[i] );}
The problem is it does not work on all the elements on the page.
It removes some of them on a random base and then gives this error: "arr[i] has no properties".
I did an experiment with the script - added it as a bookmarklet, which showed that executing multiple instances of it does remove all elements. Question is why doesn't one run do all the work?
martix is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-09-2009, 07:44 PM Re: Script yielding inconsistent results
Junior Talker

Posts: 2
Name: Martin
Trades: 0
Anyone?
martix is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Script yielding inconsistent results
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09187 seconds with 12 queries