/    Sign up×
Community /Pin to ProfileBookmark

checkbox validation

Hi just wondering why this script doesnt redirect..thanks in adavnce(it doesnt redirect the browser, although the alert shows when the checkbox is checked :

<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<title>Untitled Document</title>
<script language=”javascript”>
function checkscript(){
if (document.forms[0].checkbox.checked)
{
alert(“i have been checked”);
window.location = “http://www.google.com/“;

}else{

alert(“please agree to out terms and conditions”);

}

}

</script>
</head>

<body>
<form action=”” onsubmit=”return checkscript()”>

<p>
<input type=”checkbox” name=”checkbox” value=”checkbox”>
</p>
<p>
<input type=”text” name=”textfield”>
</p>
<p>
<a href=”” onClick=”checkscript()”>I Agree</a>
</p>
</form>
</body>
</html>

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@KorAug 26.2005 — window.location.[b]href[/b] = "http://www.google.com/";
Copy linkTweet thisAlerts:
@Jonny_LangAug 26.2005 — Tracys:

[CODE]<HTML>
<Head>
<Script Language=JavaScript>

function checkscript(isForm){

if (isForm.agreeYN.checked)
{
alert("I have been checked");
return true;
}
else {
alert("Please agree to our terms and conditions")
return false
}
}
</Script>
</Head>
<Body>
<Form method='' action="http://www.google.com/" onsubmit="return checkscript(this)">
<input type='checkbox' name='agreeYN'><br>
<input type='submit' value='submit'>
</Form>
</Body>
</HTML>[/CODE]
Copy linkTweet thisAlerts:
@tracysauthorAug 26.2005 — thanks for that theres one thing weird it only opens when i specify a FULL http address and not a relative url..any idea why this occurs?

cheers
Copy linkTweet thisAlerts:
@Jonny_LangAug 26.2005 — Cheers, nothing. I have a name and I expect to be addressed by it. Gee, now that's WEIRD. How can you be bothered by a pesky little thing like simple, common courtesy?


[URL=http://www.webdeveloper.com/forum/showthread.php?p=422859#post422859post422859]Please Read This[/URL]
Copy linkTweet thisAlerts:
@cyber1Aug 26.2005 — Cheers, nothing. I have a name and I expect to be addressed by it.

Read This[/URL][/QUOTE]



Oh please, give me a break!!

'Thanks' and a friendly gesture at the end of the message is not enough, huh?

And its probably not your real name anyways so ligthen up a bit.

?

-Bill
Copy linkTweet thisAlerts:
@Jonny_LangAug 26.2005 — NEVER post an extraneous comment in ANY thread. e.g. "Oh please, give me a break!"[/QUOTE]

NEVER:

...criticize anyone's code, nor any person.[/QUOTE]


It's irrelevant, and self-important. It's not your forum, it's not your thread, and it may shock you to learn that no one takes orders from you.

If you have ORIGINAL code of your own to offer in solution of the stated problem, or a link to someone else's code, post it.

[B]Otherwise, move along.[/B] [/QUOTE]


Always ...treat others the way you would demand to be treated.[/QUOTE]
Copy linkTweet thisAlerts:
@BigMoosieAug 26.2005 — geez [B]mate[/B], it seems you have something stuck up your behind ?
Copy linkTweet thisAlerts:
@JPnycAug 26.2005 — To not be addressed by one's username on a forum is commonplace. If being addressed by your name is a prerequisite for receiving assistance from you, please make that clear to the potential recipient of the assistance beforehand. Thank you. Thread closed.
×

Success!

Help @tracys spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...