JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old July 20th, 2004, 06:32 AM
sarathsps sarathsps is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 3 sarathsps User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up Command to come out of the javascript

hi pals

I need a command to come out of the javascript
some thing like exit(); even i tried exit(); System.exit() and break() its was not working

Pls revert me asap

sarath

Reply With Quote
  #2  
Old July 20th, 2004, 06:37 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Can you be a little more specific, maybe post some code? Perhaps "return true" will do what you want.
__________________
Please don't PM me asking for solutions outside the scope of a thread.
Keeping all responses in a thread stands to help others who come along later,
which is after all what this forum's all about.

Reply With Quote
  #3  
Old July 20th, 2004, 06:59 AM
sarathsps sarathsps is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 3 sarathsps User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hi

here is some piece of code


function sample(v1,v2)
{
if (v1.value >= v2.value)
{
alert("The Succeding value Should be GREATER than the Previous value");
v2.focus();
v2.select();
exit(); //-- here the error comes
}
}


i'm having 10 text boxes and the the value of preceeding text box is greater than the previous one.

while submiting i'm calling the function like this

sample(textbox1.value,textbox2.value);
sample(textbox2.value,textbox3.value);
sample(textbox3.value,textbox4.value);

and so on ....



Sarath

Reply With Quote
  #4  
Old July 20th, 2004, 08:29 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
You don't need to exit. You only need to exit if there's code that you want to prevent from executing under certain conditions. In this case, you have no such code and the function will exit once it's finished executing. Just remove your exit() line.

Also, please don't double-post. I've deleted your other post.

Reply With Quote
  #5  
Old July 20th, 2004, 08:31 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Incidentally, there's another problem with your code. You're passing it the field values but are then calling the focus() method on the value rather than on the field. You're also trying to use v1.value, which isn't valid, since you're actually passing v1.value. In your calls to sample(), pass the fields rather than their values (so sample(textbox1, textbox2) rather than sample(textbox1.value, textbox2.value)).

Reply With Quote
  #6  
Old July 20th, 2004, 02:43 PM
BurhanKhan BurhanKhan is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 44 BurhanKhan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
I think u want this: "if user entered data in 10 text boxes and click the submit button, then data in text boxes should be varified. And if all data is right then form should be submit, other wise not."


Put this script in your body tag

<script>

function ProcessForm()
{
function sample(v1,v2)
{
if (v1.value >= v2.value)
{
alert("The Succeding value Should be GREATER than the Previous value");
v2.focus();
v2.select();
return false;
}
else
return true;
}

// in the code below myform is your form name.

if( !sample(document.myform.textbox1 , document.myform.textbox2) ) return false;
if( !sample(document.myform.textbox2 , document.myform.textbox3) ) return false;
if( !sample(document.myform.textbox4 , document.myform.textbox5) ) return false;
.................................................. ..........................
.................................................. ...........................
}

</script>

and in your submit button do this:

<input type="submit" value="Submit" onclick="return ProcessForm()">

..................................

Burhan

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Command to come out of the javascript


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway