Click to See Complete Forum and Search --> : New window variable


dwtc
10-12-2003, 05:44 PM
Hi,

I am trying to teach my self javascript and have a problem with my project.

I have a basic open new window function in javascript and I want the content of that window to be dependent on the value of a form variable which is read from an access data base.

How do I do it?

This is what I have

<script type="text/javascript">

function openwindow2()
{
window.open("example1.swf","my_new_window","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=640, height=480")
}
</script>


within the form is

<td><img src="dimages/tbutton.jpg" value="Open New Window" onClick="openwindow2() value="<% Response.Write(LIST("content")) %>"></td>

Grateful for any help you may be able to give - Thanks

gil davis
10-12-2003, 06:58 PM
You will need to alter your fuction to accept a parameter that represents the file name you want to open. Then you need to alter the form to pass the parameter.

<script type="text/javascript">
function openwindow2(theFile) {
window.open(theFile,"my_new_window","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no ,width=640,height=480");
}
</script>
...
<img src="dimages/tbutton.jpg" onClick="openwindow2('<% Response.Write(LIST("content")) %>')">

BananaQuaalude
10-14-2003, 02:18 PM
Hi Gil,

The script below is very close to something I'm trying to accomplish. Is there anyway to dynamically change the action item of a form to open into a new window, sending all its post variables with it?

thanks!

Charles
10-14-2003, 02:28 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Example</title>

<form action="example1.swf" target="child" onsubmit="window.open(this.action, 'child', 'width=640,height=480')">
<div>
<input alt="Submit" type="image" src="dimages/tbutton.jpg">
</div>
</form>

BananaQuaalude
10-14-2003, 02:32 PM
Rockin'

I knew there was an attribute to set for a new window, but it's not in the index of the reference book I'm using.

Thanks Charles!