SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2006
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Click on submit button and script works but press enter and it doesn't

    Does anyone have any clue why I click on the go button for this code and it works the way it should. If I press enter the code doesn't work right. Any clue why this is happening or how to fix it?

    Code:
    echo "<script language=\"Javascript\">
    <!--
    var str = \"left=0,screenX=0,top=0,screenY=0\";
    if (window.screen){
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;
    str += \",height=\" + ah;
    str += \",innerHeight=\" + ah;
    str += \",width=\" + aw;
    str += \",innerWidth=\" + aw;
    } else {
    str += \",resizable\";
    }
    function call_full() {
    var saddr=document.getElementById('saddr').value;
    var daddr=document.getElementById('daddr').value;
    fullScreen('http://maps.google.com/maps?saddr='+saddr+'&daddr='+daddr+'')
    }
    //-->
    </script>";
    echo '<form name="addr_form" id="addr_form">
    <b>Get Directions</b>
    <br>
    <font size=2>Your address: (street, town, state)</font><br>
    <input type="text" size=40 maxlength=40 name="saddr" id="saddr" value="" />
    <input type="button" type="submit" onClick="call_full()" value="Go">
    <input type="hidden" name="daddr" value="40.00000, -80.00000"/>
    </form>';

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2006
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I got it to work
    I had to change this line:

    Code:
    echo '<form name="addr_form" id="addr_form">
    to

    Code:
    echo '<form name="addr_form" id="addr_form" onSubmit="call_full(); return false;">


Bookmarks

Posting Permissions

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