Forum Moderators: open
however, since i don't know anything about javascript, I thought I'd ask for some help :)
this is the stuff that goes on the page calling the script, "myfile.js"
<SCRIPT LANGUAGE="JavaScript" SRC="http*://www.myurl-here/myfile.js"></SCRIPT>
onUnload=doStuff"(varvalue)">
here's the code that the page is calling in the 'onUnload event':
function doStuff(id) {
var sysurl="http*://www.myotherurl-here.com/directory";
var url=(sysurl)+"/redirect.cgi?id="+(id);
var exit=true;
if (exit) {
window.open(url,'openStuff','width=800,height=600,top=5000,left=5000,scrollbars=yes,location=yes,directories=no,
status=yes,menubar=no,toolbar=no,resizable=yes');
}
self.focus();
}
That's about the size of it. What I'm trying to do is pass the value from the javascript 'onUnload' event into the pop up script file, which then opens the new window with the value passed in from the original html file into the perl script...hope that makes sense.
I'm not a Javascript whiz by any means but those double quotes look awfully suspicious.
Also, what is the purpose of the asterisk in the url cited in the function and in the external .js call?
You could add 'screenX=5000', 'screenY=5000' to window.open's attributes for rendering window distance in NN4+.
The script is erroring out on the page as it loads...hm. If I put the url in the window.open, then that defeats the purpose of trying to pass in the value from the html page with the onUnload function...
which value the javascript needs to pass to my perl script, so that my application can work :) he he. (it's almost giving me a headache).
I've got an example that works...but I tried to port it over, and then got stuck with the mess I'm in now.
this stuff...
<html>
<head>
<title>Do Stuff</title>
<!--dostuff.html-->
</head>
<body>
<script language="JavaScript">
<!--
var di = "toad";
function doStuff(id) {
var sysurl="otherstuff";
var url=sysurl+".html?id="+id;
window.open(url,'openStuff','width=350,height=150,top=5,left=5,scrollbars=yes,location=yes,directories=no,status=yes,menubar=no,toolbar=no,resizable=yes');
}
//-->
</script>
<form>
<input type=button value="Do Stuff!" onClick=doStuff(di)>
</body>
</html>
<html>
<head>
<title>Other Stuff</title>
<!--otherstuff.html-->
</head>
<body>
Doing other stuff
</body>
</html>
...with this url:
.../otherstuff.html?id=toad
I just altered the Event (onClick) and added the value to the 'di' variable for this purpose.
I really hope I haven't wasted your time and that this will help in some way.
(edited by: toadhall at 2:14 am (utc) on Mar. 23, 2002)