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 2 of 2

Thread: simple problem

  1. #1
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts

    simple problem

    my code:

    <script type="text/javascript">
    function insert_url() {
    var url = window.prompt('Please enter the URL of your link:', 'http://');
    var urlname = window.prompt('Please enter a name for your link:', '');

    if(url) {
    url = '' + url + '[a]' + urlname + '';
    var tarea = document['post']['message'];
    if(tarea.createTextRange && tarea.caretPos) {
    var cpos = tarea.caretPos;
    cpos.text = (cpos.text.charAt(cpos.text.length - 1) == ' ') ? url + ' ' : url;
    }
    else tarea.value += url;
    tarea.focus();
    }
    }
    </script>

    Hello,
    I tried adding this line to the above code:
    var urlname = window.prompt('Please enter a name for your link:', '');

    but for some reason, when i enter a value is does not show up in here:
    url = '' + url + '[a]' + urlname + '';

    the + url +
    still just shows up twice?

    what am i doing wrong here?

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    nevermind,,
    i'm a dumb ***, it does work,
    i forgot to refresh the page..



  •  

    Posting Permissions

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