...

View Full Version : Button wont work unless refreshed



Mack911
04-30-2007, 08:09 AM
Hi .. !! everything works fine in this code.. but the only problem I can use the button just once, unless I refresh the page. Thanks in advance. _________________________________________________________________
<html>
<head>
<
<script type="text/javascript">
function email()
{
email = window.prompt("WHAT IS YOUR E-MAIL ADDRESS?");
test ()
}
function test()
{
if (email.indexOf('@') != -1)
{ alert ("VALID E-MAIL");
write() }
else
{ alert("INVALID EMAIL"); }

}
</script>
<title>Page 6</title>
</head>

<body>
<form>
<input type="button"
onclick="email()"
value="Click Here !!">
</form>

<script type="text/javascript">
function write()
{
alert("Thankyou For Entering Your E-Mail Address");
}
</script>

</body>
</html>

abduraooft
04-30-2007, 08:31 AM
The problem is in..
email = window.prompt("WHAT IS YOUR E-MAIL ADDRESS?");

Once it executed, the email function disappears !

Change that variable name to say 'email1' and make changes in the following lines also..



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum