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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I want to use data from an input to create a URL

    Can anyone help me with this code? I would like to take the data entered from this string:
    Code:
    <input type="text" size=40 maxlength=40 name="saddr" id="saddr" value="" />
    and the data from this line:
    Code:
    <input type="hidden" name="daddr" value="40.00000, -80.00000"/>
    and insert it into this :
    Code:
    onClick="fullScreen(\'http://maps.google.com/maps?saddr=\')"
    so that the link would be something like this:

    http://maps.google.com/maps?saddr=41...0000,-80.00000

    The whole code I am working on is below

    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 fullScreen(theURL) {
    return window.open(theURL, '', str);
    }
    //-->
    </script>";
    echo '<form name="addr_form" id="addr_form" onSubmit="fullScreen(); return false;">
    <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="fullScreen(\'http://maps.google.com/maps?saddr=&daddr=\')" value="Go">
    <input type="hidden" name="daddr" value="40.00000,-80.00000"/>
    </form>';

  • #2
    New to the CF scene
    Join Date
    Nov 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I want to something like this but I think I am missing something.

    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 fullScreen(theURL) {
    return window.open(theURL, '', str);
    }
    var InfoHTML = '<form name=\"addr_form\" id=\"addr_form\" onSubmit=\"fullScreen(\'http://maps.google.com/maps?saddr='+saddr+'\'); return false;\"><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=\"fullScreen(\'http://maps.google.com/maps?saddr='+saddr+'\')\" value=\"Go\"><input type=\"hidden\" name=\"daddr\" value=\"40.00000, -80.00000\"/></form>'
    document.write(InfoHTML);
    var saddr=document.getElementById('saddr').value;
    var daddr=document.getElementById('daddr').value;
    //-->
    </script>";

  • #3
    Regular Coder
    Join Date
    May 2005
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't have time to modify your code, but from the first example elements you could use this:
    Code:
    onClick="fullScreen(\'http://maps.google.com/maps?saddr=\'+document.getElementById('saddr').value+'&daddr='+document.getElementById('daddr').value)"
    Last edited by VortexCortex; 11-02-2006 at 10:28 PM.


  •  

    Posting Permissions

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