Results 1 to 2 of 2

Thread: Dynamic div tag content?

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

    Exclamation Dynamic div tag content?

    Hello,
    I am trying to generate an overlapping popup (using a script from DynamicDrive.com). The script works great, but my situation is this:

    I have several links that each bring up a form for the user to complete. The form needs to have some hidden variables passed to it, and those depend on the link that is clicked.

    Is there a way to pass variables from the link to the DIV tag so I don't need to create 12 different DIV tags to serve each individual link? I guess I'm asking: is it possible to have the DIV tag put in the correct variables (for the form) when the link is clicked?

    Thank you!

    avgeek84

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You can do something like so:

    HTML Code:
    <a href="#" onclick="openDiv();return false">Link Text</a>
    then have a function in a script block in the head:

    Code:
    function openDiv(){
    var val1=document.getElementById('nameField').value;
    var val2=document.getElementById('addressField').value;
    var val3=document.getElementById('phoneField').value;
    etc . . .
    then code here to open the div and
    code inserting the above values in its fields
    }
    But, this is better done with a server side language as, you cannot be certain folks will have javascript enabled.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •