Click to See Complete Forum and Search --> : Help with script


webdeveloper
12-11-2002, 12:02 PM
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,

Charles
12-11-2002, 12:17 PM
<!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>

webdeveloper
12-12-2002, 07:27 AM
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,