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

Thread: Insert text

  1. #1
    Regular Coder
    Join Date
    Feb 2006
    Posts
    112
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Insert text

    I have this link. I want to fill a text box with an id of "first" with the cookie value but it's not working.

    <a href="#" onclick="document.getelementById('first').value = 'recent1'">'+getCookie("recent1")+'</a>';

    Any idea why not?

    Thanks.
    C

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Javascript is case-sensitive.
    Code:
    document.getElementById('first').value = 'recent1'
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    Regular Coder
    Join Date
    Feb 2006
    Posts
    112
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the reply. It doesn't seem to work. Tearing my hair out now.

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Can you elaborate? Saying it doesn't work doesn't help.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You should probably post the rest of your code, so we can see how you are outputting the link.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #6
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,461
    Thanks
    11
    Thanked 600 Times in 580 Posts
    Quote Originally Posted by buildrebuild View Post
    I have this link. I want to fill a text box with an id of "first" with the cookie value but it's not working.

    <a href="#" onclick="document.getelementById('first').value = 'recent1'">'+getCookie("recent1")+'</a>';

    Any idea why not?

    Thanks.
    C

    your code is in the middle of the tag, not in the onclick handler.
    Code:
    //do you mean something like:
    <a href="#" onclick="document.getelementById('first').value =getCookie('recent1')" >recent1</a>';


  •  

    Posting Permissions

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