erezes Posted March 21, 2013 Share Posted March 21, 2013 (edited) for (i=0; confDoc.getElementsByTagName("imgsub").hasChildNodes(); i++){ w = confDoc.getElementsByTagName("imgsub");tmp_title = w.getElementsByTagName("pic_title")[0].childNodes[0].nodeValue; { I want to cancel the loop,only of [0], how I write it. i try and try ....... Thanks helpers Edited March 21, 2013 by erezes Link to comment Share on other sites More sharing options...
justsomeguy Posted March 21, 2013 Share Posted March 21, 2013 You can use a break statement to end a loop, or a continue statement to stop the current iteration and go to the next. https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Statements/breakhttps://developer.mozilla.org/en-US/docs/JavaScript/Reference/Statements/continuehttp://www.w3schools.com/js/js_break.asp Link to comment Share on other sites More sharing options...
erezes Posted March 21, 2013 Author Share Posted March 21, 2013 I do not want to add,But to remove the loop completely, just go to a place [0]Write it in the same row without the loop Idea? Link to comment Share on other sites More sharing options...
Ingolme Posted March 21, 2013 Share Posted March 21, 2013 Just substitute the "i" for a 0 and remove the loop. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now