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
  1. #1
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to pass dynamic variable to another div with onclick?

    Hello, I am trying to access a dynamic asp variable with onclick either in a javascript function where I can use it globally or set another div id with this dynamic variable.

    Any help is very much appreciated. Thank you!



    <script>
    function doSomething(article_id)
    }
    return article_id;

    }
    </script>

    <a href="#test" onClick="doSomething("<%=rsHeadline("article_id")%>")">try here...</a>

    <div id="test">
    <%articleid = request.querystring("article_id") %>
    <% Response.Write articleid %>
    The article id is articleid</div>
    Last edited by dmarmolejos; 08-30-2010 at 03:15 PM.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,014
    Thanks
    79
    Thanked 4,435 Times in 4,400 Posts
    Make up your mind: If the value coming from the DB as in rsHeadline("article_id") or from the querystring as in request.querystring("article_id")????

    It can't come from both. Or I certainly wouldn't expect it to.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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