user310291
user310291

Reputation: 38190

Why onclientclick do a postback?

I have an asp button with no onclick event but only onclientclick. This call a javascript function in a iframe in which a video is playing;

each time I click the javascript function is called but also the video restart which means the page is reloaded.

How to prevent this ?

Upvotes: 1

Views: 3572

Answers (2)

David Morton
David Morton

Reputation: 16505

return false from your onclientclick.

OnClientClick="LoadVideo();return false;"

Upvotes: 7

Paul Creasey
Paul Creasey

Reputation: 28844

add

 return false;

to you function.

Upvotes: 3

Related Questions