Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing a variable to a function

Status
Not open for further replies.

TurboSRT4

Programmer
Nov 23, 2009
47
US
Hello! quick question..... I need to kow how to pass a variable to a function such as......

function test(){

var my_var=;
alert(my_var)
}

<a href=javascript:test();>TEST</a>

can i define the value of my_var in the link somehow?

maybe like this <a href=javascript:test()?my_var="test var">

so the alert box will appear with the value"test var"

thanks guys your all great!
 
That's great that you got it sorted out, but you call yourself a "Programmer" and you had to ask how to pass a variable to a function?

Seriousy?

And who were you thanking?


--------

GOOGLE is a great resource to find answers to questions like "how do i..."


--------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top