SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Apr 2004
    Location
    Texas
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Adding text to form when clicked

    Is there anyway for me to add text to a forum when the link is clicked?

    Kinda like at http://ladder.socomnet.com/alt_popup.php

    Like when one of those text boxes is clicked the text clicked is added to a form on that same page.

    That demo I setup is someone elses work I took but it's set to go to another page when it's clicked. I don't want it to go to another page, I simply want it to just be added to a text form in the main page when it's clicked, the member can then copy it to the other page. Can someone help me setup a javascript to get this going? Thanks!
    Last edited by Blud Shot; May 26, 2004 at 01:05.

  2. #2
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    something like this?

    Code:
    <script>
    function addText(event){
    	document.getElementById("box").value +=
    		(event.srcElement || event.target).firstChild.nodeValue.toString();
    }
    </script>
    
    <input id="box">
    
    <table border=1 cellspacing=0 onclick=addText(event)>
    <tr><td>A</td><td>B</td><td>C</td></tr>
    <tr><td>D</td><td>E</td><td>F</td></tr>
    </table>

  3. #3
    SitePoint Member
    Join Date
    Apr 2004
    Location
    Texas
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes, thanks sooooo much!

  4. #4
    ********* Scotland Saltire's Avatar
    Join Date
    Jan 2000
    Location
    Scotland
    Posts
    660
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I want to be able to do basically the same, but I need it so when a list of text links are clicked in a popup window, it populates a form field named 'venue' on the original page to have the value of the text link just clicked.

    Anyone?

    Thanks!


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
  •