Click to See Complete Forum and Search --> : Problem with resizing new browser using buttons


Taylor_1978
06-13-2003, 10:57 AM
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!

Khalid Ali
06-13-2003, 11:24 AM
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" >

Taylor_1978
06-13-2003, 12:57 PM
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 :D

Taylor_1978
06-13-2003, 12:59 PM
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