/    Sign up×
Community /Pin to ProfileBookmark

Can’t get window to work!

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 [url]http://[/url] 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>

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@superwomanauthorDec 11.2002 — Thanks Dave, I changed it around and it works, I had a misspelled word that was problematic, but now it works! thanks!?
Copy linkTweet thisAlerts:
@superwomanauthorDec 11.2002 — 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>
Copy linkTweet thisAlerts:
@superwomanauthorDec 11.2002 — 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!?
Copy linkTweet thisAlerts:
@gil_davisDec 11.2002 — Change

[font=courier]var winOutputSettings="width="+winWidth+",height="+winHeight[/font]

to

[font=courier]var winOutputSettings = "width=" + winWidth + ",height=" + winHeight + ",top=" + winTop + ",left=" + winLeft;[/font]
Copy linkTweet thisAlerts:
@superwomanauthorDec 11.2002 — 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.?
Copy linkTweet thisAlerts:
@superwomanauthorDec 11.2002 — 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!?
×

Success!

Help @superwoman 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.19,
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,
)...