/    Sign up×
Community /Pin to ProfileBookmark

Help with script

Hi,

Can someone help with this code, its not working.
On clicking the OK button I need it to go to specific url. On Cancel button and ‘x’, close button, I need to close this form as well as the internet browser. Here is the following I have so far:

<html>
<head>
<script language=”JavaScript” type=”text/javascript”>
<!–
function close_window() {
window.opener = “fred”;
window.close();
}
//–>
</head>

<body onLoad=’document.formValidate.OK.focus()’>
<form name=’formValidate’>
<table>
<tr>
<td><h3><b>Are you sure you want to continue?</b></h3></td>
</tr>
<tr>
<td>
<input type=’button’ value=’OK’ onClick=”http://www.microsoft.com“>
<input type=’button’ value=’Cancel’ onClick=”close_window()”>
</td>
</tr>
</table>
</form>
</body>
</html>

Thanks in advance,

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@CharlesDec 11.2002 — [font=monospace]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

"http://www.w3.org/TR/html4/strict.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Example</title>

<form action="http://www.w3c.org/" name="myForm">

<div>

<input type="submit" value="I Love Standards">

<script type="text/javascript">

<!--

document.write('<input type="button" value="I Hate Standards" name="close">');

document.forms.myForm.close.onclick = function(){self.close()}

// -->

</script>

</div>

</form>[/font]
Copy linkTweet thisAlerts:
@webdeveloperauthorDec 12.2002 — Thanks alot.

That is exactly what I needed.

What I would also need to to is I am testing a cookie and depending on the cookie result I need to call this form. How would I do this?

I am thinking that inside the code I have to have a script that would submit or click the "I Love Standards" button.

Thanks in advance,
×

Success!

Help @webdeveloper 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.18,
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,
)...