Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Split Numbers!

Reply
Thread Tools

Split Numbers!

 
 
Arpan
Guest
Posts: n/a
 
      05-14-2005
The number '60' can be written as (50+10) or (25+35) or (15+45) or (7+53) etc... but I want the output as (50+10) only when 60 is typed in a textbox & the Form is submitted. How do I do this?

Thanks,

Arpan
 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      05-14-2005
Arpan wrote on 15 mei 2005 in microsoft.public.inetserver.asp.general:

> The number '60' can be written as (50+10) or (25+35) or (15+45) or
> (7+53) etc... but I want the output as (50+10) only when 60 is typed
> in a textbox & the Form is submitted. How do I do this?
>


first, never send HTML on usenet.

==============

Would this do?


<form onsubmit="doit()">
<input id="myInput">
......

<script>
function doit(){
myInput = document.getElementById("myInput")
if(myInput.value==60)myInput.value="(50+10)"
}
</script>


--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

 
Reply With Quote
 
 
 
 
Roland Hall
Guest
Posts: n/a
 
      05-15-2005
"Arpan" wrote in message news:eKzz%(E-Mail Removed)...
The number '60' can be written as (50+10) or (25+35) or (15+45) or (7+53)
etc... but I want the output as (50+10) only when 60 is typed in a textbox &
the Form is submitted. How do I do this?

An ASP alternative would be:

<%
dim strInput, postback

postback = Request.Form("postback")
if postback = "postback" then
strInput = Request.Form("myInput")
if strInput = "60" then
strInput = "(50 + 10)"
end if
end if
%>

<form id="myform" name="myform" method="post" action="" />
<input id="mytext" name="mytext" value="" />
<input id="postback" name="postback" type="hidden" value="postback" />
<input type="submit" />
</form>

Note: this routine has no security

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
a split is not a split Dumbell Computer Support 3 03-09-2009 10:45 PM
String#split(/\s+/) vs. String#split(/(\s+)/) Sam Kong Ruby 5 08-12-2006 07:59 PM
How can I split database results with ExecuteReader and Split? needin4mation@gmail.com ASP .Net 2 05-05-2006 10:36 PM
split on '' (and another for split -1) trans. (T. Onoma) Ruby 10 12-28-2004 06:36 AM
Small inconsistency between string.split and "".split Carlos Ribeiro Python 11 09-17-2004 05:57 PM



Advertisments