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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change from form event to onclick link 1

Status
Not open for further replies.

tyutghf

Technical User
Apr 12, 2008
258
GB
I have a form that has javascript actions on it

<form name="form" id="formid">
<select multiple size='5' name="sel1" onchange="myfunction(this.options[this.selectedIndex].value)" >
<option value='foo.doc'>Foo</option>
<option value='foo2.doc'>Foo 2</option>
</select>
</form>

THis is probably really simple ut I have been trawling the web for ages and can`t find the answer, how do I make the above work on a set of links instead of a form, i.e.

<a href='onclick="myfunction(foo.doc)"'>foo</a><br />
<a href='onclick="myfunction(foo2.doc)"'>foo 2</a><br />

Thanks
 
I'm very surprised that you weren't able to find a working example of an onclick event on the entire Internet. Well not that surprised I guess. Here...

<a href="#" onclick="myfunction('foo.doc');return false;">foo</a><br />

Adam
 
Thanks mate, I was almost there :eek:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top