Click to See Complete Forum and Search --> : Passing variable from a link to a function


dgcotton
09-01-2003, 05:29 PM
How do I pass a varibale from a link in a page to a function defined at the begining and then have that function pass the variable to a js script?

Khalid Ali
09-01-2003, 06:16 PM
I am presuming you wanted to pass a parameter when you click on a link?
Use the onclick event of the link

suppose your function name is

Test() and it takes one parameter
val,it may look like this

function Test(val){
alert(val);
}

now your link may look like this

<a href="xxxx.html" onclick="Test('this is a test mesaage');return false">Click here</a>

where return false will stop the browser to execute default link behavior.