Jump to content

carry variable with javascript


alohatofu

Recommended Posts

Avoid use of the word JavaScript in your href's.  Instead, use an href like #, and put your code for the function in the onclick attribute of your link.

 

To answer your question, what you are suggesting will work, except you need to use

 

<a href="#" onclick="return freak_new(<?php echo $number ?>)">Click me</a>

 

If you use something like this format, you can return false, and cancel the link (if you need to).  If you return true, the link goes through.

 

Dave

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.