Running Javascript from an Imagebutton

J

John

Hi all,

How do I run some Javascript code from an Imagebutton?

I place the Javascript code inn the onclick in my html section but IE is not
running it.

Regards
John.
 
J

Jos

John said:
Hi all,

How do I run some Javascript code from an Imagebutton?

I place the Javascript code inn the onclick in my html section but IE
is not running it.

Regards
John.

You need to use the Attributes collection, because ASP.NET
is overwriting the onclick on the button to generate the
postback.

myImgBtn.Attibutes.Add("onclick","javascript code goes here")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top