| |

VerySource

 Forgot password?
 Register
Search
View: 929|Reply: 2

How does JS trigger a postback event? Is postback

[Copy link]

1

Threads

18

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-12-25 10:30:02
| Show all posts |Read mode
RT.
I want the user to generate a postback event when leaving a div, that is, the onmouseout event. How do I do that?
Reply

Use magic Report

0

Threads

21

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-12-25 10:45:02
| Show all posts
<div onmouseout="document.forms[0].submit();">

</div>
Reply

Use magic Report

0

Threads

64

Posts

35.00

Credits

Newbie

Rank: 1

Credits
35.00

 China

Post time: 2020-12-25 11:00:01
| Show all posts
First of all, determine who to send back to? !

Assuming that a button is triggered, you can write:
  thePanel.Attributes["onmouseout"]=
    this.Page.ClientScript.GetPostBackEventReference(theButton,"");

Suppose it is in a control, especially in ascx or aspx to define the triggered background code, then you can use the IPostbackEventHandler interface for your user control or page type (it actually only defines a method), and then write the code to let the customer Trigger it at the end:
  thePanel.Attributes["onmouseout"]=
    this.Page.ClientScript.GetPostBackEventReference(this,"");

IPostbackEventHandler is the key to post back a server program and script. GetPostBackEventReference and GetPostBackClientHyperlink are the functions you use to generate script code.

You can search for the usage of IPostbackEventHandler, GetPostBackEventReference, GetPostBackClientHyperlink.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list