/    Sign up×
Community /Pin to ProfileBookmark

Problem with resizing new browser using buttons

Hiya!

I am trying to get my new page ‘rooms/index.php’ to open up in a resized browser, using a form and button as follows:

<form method=post onsubmit=”NewWindow(this.href,’Test’,’660′,’480′,’no’,’center’);return false” onfocus=”this.blur()” OnMouseOver=”window.status='<? echo $roomname ?>’; return true” onMouseout=”window.status=”” action=rooms/index.php><input style=font-size:7pt style=color:green style=background:white type=submit value=’Load Room’></form>

What it does do, is open a new browser, resized correctly, but it goes to mydomain.com/undefined instead of mydomain.com/rooms/index.php

If I use it with <A HREF= then it works fine… eg:

<a href=rooms/index.php onclick=”NewWindow(this.href,’Test’,’660′,’480′,’no’,’center’);return false” onfocus=”this.blur()” OnMouseOver=”window.status='<? echo $roomname ?>’; return true” onMouseout=”window.status=”” action=rooms/index.php>Load Room</a>

Problem being I do not want it to be a link as such, but the button…

Just as a FYI.. this is the script I am using in my head:

<script language=”javascript” type=”text/javascript”>
<!–
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos==”random”){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos==”center”){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!=”center” && pos!=”random”) || pos==null){LeftPosition=0;TopPosition=20}
settings=’width=’+w+’,height=’+h+’,top=’+TopPositi
on+’,left=’+LeftPosition+’,scrollbars=’+scroll+’,l
ocation=no,directories=no,status=yes,menubar=no,to
olbar=no,resizable=yes’;
win=window.open(mypage,myname,settings);}
// –>
</script>

Any idea’s on how I can get it to work? I am sure it’s rather simple, however my expertise is PHP not JavaScript, and I have searched everywhere and cannot seem to find an answer!

Thank you in advance!

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliJun 13.2003 — If you want to open a new window using just a button then you only need this code

<input type="button" value="Open Popup" onclick="NewWindow('rooms/index.php','Test','660','480','no','center');return false" >
Copy linkTweet thisAlerts:
@Taylor_1978authorJun 13.2003 — Ummm - are you trying to tell me that I don't need all the other jargon that I have in my head code?

If all I need is the script you showed I am going to scream - happy none the less but I'll still scream LOL ?
Copy linkTweet thisAlerts:
@Taylor_1978authorJun 13.2003 — Oh - hang on - I think I do still need it because it tells it to not have a menu bar etc... right? *shrugs* PHP is my thing - not that good with JS lol
×

Success!

Help @Taylor_1978 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.24,
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,
)...