Web Analytics Made Easy -
StatCounter onclick() and php - CodingForum

Announcement

Collapse
No announcement yet.

onclick() and php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • onclick() and php

    help!

    What I want to do, is to allow the user to click on a hyperlink, which changes the background image, while setting a php value...

    I'm not sure why it isn't working, this is the code I have:

    <a href="?spark=links.htm" onClick="document.body.style.backgroundImage='url(../img/purple.gif)'">links</a><br>

    it works if I set href="#" but not with the PHP code.
    The php works otherwise, just the background doesn't change.

    Anyone know why?

  • #2
    the link reload the page with when it is ="?spark=links.htm"
    there by negating the effect of the onclick javascript.
    as oposed to when it is "#" then the link just searches for an anchor on the page(in this case nothing).

    what you wanna do is on the server print the bodys style dependant on what spark equals I think.

    Comment

    Working...
    X