Forums
This topic is locked
The equivalent of a Goto Comand in Javascript.
Posted 18 Mar 2005 22:57:05
1
has voted
18 Mar 2005 22:57:05 Raul Raulito posted:
Hi,I am a complete beginner ,trying to learn some Javascript. I was asking myself if there is a command , like the Goto command in Basic. I remember:
10 bla bla
20 bla bla
30 if (Something) goto 10
Or if this is more helpful:
var number ;
number = prompt("Please enter a number"," "
number = parseInt(number)
if (isNaN(number))
{
document.write("This is not a number<br />"
document.write(" Please try again!"
}
else
{
var result ;
result = 2*number ;
document.write("The number times two is = "+result);
}
Just after the
"Please try again",..., I'd like to make it return to the first line, therefore asking the user to add another input,...
Could anybody point me in the right direction of a command which would do this?
Many Thanks!
Replies
Replied 19 Mar 2005 23:52:24
19 Mar 2005 23:52:24 Chris Charlton replied:
You should learn about making JS (JavaScript) <i>functions</i>.
~ ~ ~ ~ ~ ~ ~
Chris Charlton <i>- DMXzone Manager</i>
<font size=1>[ Studio MX/MX2004 | PHP/ASP | SQL | XHTML/CSS | XML | Actionscript | Web Accessibility | MX Extensibility ]</font id=size1>
~ ~ ~ ~ ~ ~ ~
Chris Charlton <i>- DMXzone Manager</i>
<font size=1>[ Studio MX/MX2004 | PHP/ASP | SQL | XHTML/CSS | XML | Actionscript | Web Accessibility | MX Extensibility ]</font id=size1>