...

View Full Version : New browser resized, but with a button instead of a href.. wont work for me...



Taylor_1978
06-12-2003, 09:20 PM
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='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',l ocation=no,directories=no,status=yes,menubar=no,toolbar=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!

ACJavascript
06-12-2003, 10:48 PM
Mabye instead of putting this.href. just put the actual link in it. rooms/index.php

Taylor_1978
06-12-2003, 11:27 PM
NOPE! Didn't work.. thanks for replying though - all it did was open it up in a normal broswer, not a resized one.

Any other suggestions?

Taylor_1978
06-13-2003, 04:53 PM
Anyone? :)

ACJavascript
06-13-2003, 05:01 PM
When I did this it opened in a resized window.

<form method=post onsubmit="NewWindow('rooms/index.php','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>

Taylor_1978
06-13-2003, 05:59 PM
THANK YOU TAHNK YOU!

You were right the first time... Was just my own stupidity for not placing the url in 'single-quotes'

YOU'RE A LIFE SAVER!

Ok.. wasn't that desperate - but my headache I have had for 3 days seems to have gone :D

ACJavascript
06-13-2003, 08:15 PM
LOL glad it works :D :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum