Running Javascript from an Imagebutton

  • Thread starter Thread starter John
  • Start date Start date
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.
 
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")
 
Back
Top