linking an element by id URL

Discussion in 'Coding Help' started by Ronan, Oct 25, 2012.

Tags:
  1. Ronan

    Ronan New Member

    Hello

    I recently got into learning about coding and I'm trying to develop a widget for a WordPress site.
    I'm so close it's ridiculous but can't seem to get the last bit right. If you look at the code below
    you will see it asks for your



    1. phone number
    2. user name
    3. password

    This generates a completed URL which sends a text message however getting the element-by-id to
    return as a link is proving difficult. I have gotten as far as getting the Id to show as "Send Text" but
    it doesn't link to anything. I would be delighted if somebody could help me with this

    Thank You
    Ronan

    <!DOCTYPE html>
    <html>
    <body>


    <p>Click the button to demonstrate the prompt box.</p>


    <button onclick="myFunction()">Try it</button>


    <p id="demo" ></p>


    <script>
    function myFunction()
    {
    var x;


    var number=prompt("Please enter your number (e.g. for IRE - 35387***) (for multiple numbers use a comma to seperate them","");
    var user=prompt("Please enter your user name","");
    var password=prompt("Please enter your password","");




    if (name!=null)
    {
    x="<a herf="http://www.webtext.com/api/send_text.html?api_id="+user+"&api_pwd="+password+"&txt=%2301%23&dest="+number+"&tag=Text%20On">Send Text</a>";
    document.getElementById("demo").innerHTML=x;
    }
    }
    </script>


    </body>
    </html>
     

Share This Page