Click to See Complete Forum and Search --> : Can't get window to work!


superwoman
12-10-2002, 08:02 PM
Hi, I'm trying to get a window to open from a user's input. I've been struggling to get it to work. Here is my code, any help at all would be greatly appreciated. I'm going crazy over this!
<html>
<head>
<title>Window Manipulation</title>
</head>
<body>
<script language="javascript">
var winURL=document.windowForm.url.value;
var winWidth=document.windowForm.screenwidth.value;
var winHeight=document.windowForm.screenheight.value;
var winTop=document.windowForm.positonheight.value;
var winLeft=document.windowForm.positionwidth.value;

var winOutputSettings="width="+winWidth+",height="+winHeight
alert(winOutputSettings)
function changeWindow(){
var myWin=window.open(winURL,"newWindow",winOutputSettings)
}
</script>
<form name="windowForm">
<p>URL (must type http:// before url)<input type="text" name="url"></p>
<br>
<br>
Desired Screen Width (x)<input type="text" name="screenwidth">
Desired Screen Height (y)<input type="text" name="screenheight">
<br>
<br>
Screen Position Width (x)<input type="text" name="positionwidth">
Screen Position Height (y)<input type="text" name="positionheight">
<br>
<br>
<input type="button" value="Change Window!" name="myButton" onClick="changeWindow()">
</form>
</body>
</html>

superwoman
12-10-2002, 09:26 PM
Thanks Dave, I changed it around and it works, I had a misspelled word that was problematic, but now it works! thanks!:)

superwoman
12-10-2002, 10:06 PM
I thought I had it figured out! I can't get the position to work out. The height and width of the window works fine. How can I get the position moved?
Here's my code again. Thanks for your help! I really appreciate it!:)

<script language="javascript">

function changeWindow(){
var winURL=document.windowForm.url.value;
var winWidth=document.windowForm.screenwidth.value;
var winHeight=document.windowForm.screenheight.value;
var winTop=document.windowForm.positionheight.value;
var winLeft=document.windowForm.positionwidth.value;

var winOutputSettings="width="+winWidth+",height="+winHeight
alert(winOutputSettings)
var myWin=window.open(winURL,"newWindow",winOutputSettings)
}
</script>
<form name="windowForm">
<p>URL (must type http:// before url)<input type="text" name="url"></p>

<br>
<br>
Desired Screen Width (x)<input type="text" name="screenwidth">
Desired Screen Height (y)<input type="text" name="screenheight">
<br>
<br>
Screen Position Width (x)<input type="text" name="positionwidth">
Screen Position Height (y)<input type="text" name="positionheight">
<br>
<br>
<input type="button" value="Change Window!" name="myButton" onClick="changeWindow()">
</form>

superwoman
12-11-2002, 08:14 AM
I tried what you said to do, but it still won't work. Should I try to use the window moveTo method? I've never used it before, but I looked it up in my javascript bible. Thanks again Dave!:)

gil davis
12-11-2002, 08:31 AM
Change

var winOutputSettings="width="+winWidth+",height="+winHeight

to

var winOutputSettings = "width=" + winWidth + ",height=" + winHeight + ",top=" + winTop + ",left=" + winLeft;

superwoman
12-11-2002, 08:47 AM
I've done what you said to do but it still isn't working! I'm getting an error on line 38 saying it's expecting an object. Thanks though Gil.:)

superwoman
12-11-2002, 08:51 AM
Thanks Gil, one little thing in my code was wrong and it was screwing up the rest of it! It did work. Thanks so much! I appreciate it!:)