Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Jun 2003
    Location
    Australia
    Posts
    528
    Thanks
    8
    Thanked 8 Times in 8 Posts

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

    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!

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    FL, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mabye instead of putting this.href. just put the actual link in it. rooms/index.php
    CYWebmaster.com - See why we dot com!!
    ACJavascripts.com - Cut & Paste Javascripts!
    SimplyProgram.com - Personal Blog

  • #3
    Regular Coder
    Join Date
    Jun 2003
    Location
    Australia
    Posts
    528
    Thanks
    8
    Thanked 8 Times in 8 Posts

    WAAA!

    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?

  • #4
    Regular Coder
    Join Date
    Jun 2003
    Location
    Australia
    Posts
    528
    Thanks
    8
    Thanked 8 Times in 8 Posts
    Anyone?

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    FL, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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>
    CYWebmaster.com - See why we dot com!!
    ACJavascripts.com - Cut & Paste Javascripts!
    SimplyProgram.com - Personal Blog

  • #6
    Regular Coder
    Join Date
    Jun 2003
    Location
    Australia
    Posts
    528
    Thanks
    8
    Thanked 8 Times in 8 Posts
    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

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Location
    FL, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts
    LOL glad it works
    CYWebmaster.com - See why we dot com!!
    ACJavascripts.com - Cut & Paste Javascripts!
    SimplyProgram.com - Personal Blog


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •