SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    Denmark
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    onclick defined variable - print variable some place in document

    i'm not really sure how to explain this, since I know nothing about javascript, so i'll try and illustrate by the use of php (hope it makes sence)

    I have a set of different links, like:

    <a href="link.com?page=text1">text 1</a>
    <a href="link.com?page=text2">text 2</a>
    <a href="link.com?page=text3">text 3</a>
    etc, where page is dynamic and can be anything I chose..

    Another place in the same document, I echo out what the page variable is, like:

    echo "$page";
    so when clicking "text 1" the echo will output what i've defined the page to be, in this case "text1" ..

    So I want to be able to click the links and change the output of the echo all depending on what i've defined in the link - without refreshing the page!

    Is there any easy way to do this?

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mrsam View Post
    Another place in the same document, I echo out what the page variable is
    Page variable or variables of href values? Or variable of the page you're currently on?

    Quote Originally Posted by mrsam View Post
    when clicking "text 1" the echo will output what i've defined the page to be, in this case "text1
    When you click on the link you will be redirected and no "echo" will happen.

    ???

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    Denmark
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hehe , thought it didn't make any sence... I figured something out, in another direction ... thanks alot for looking though


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
  •