| |

VerySource

 Forgot password?
 Register
Search
View: 1053|Reply: 7

A JS trouble! Urgent !!!!

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-28 12:00:01
| Show all posts |Read mode
Add a JS return confirm ('Are you sure you want to query?') On a Button; click "Yes" to trigger an event on the server side, and click "No" to trigger another event on the server side! That is how to get JS on the server Return value! Thank you! Urgent !!!
Reply

Use magic Report

1

Threads

18

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-2-23 19:00:02
| Show all posts
That ’s it. If you click No, it ’s the equivalent of canceling the click. Clicking Yes is what I really want to click. That's what it means.
Reply

Use magic Report

0

Threads

29

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-2-23 19:45:01
| Show all posts
ajax, xmlhttp also works
Reply

Use magic Report

1

Threads

18

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-2-23 21:45:01
| Show all posts
If you implement this, I can do another button. If not, the other button executes the click event, just makes it invisible.

Or do it with ajax.
Reply

Use magic Report

0

Threads

58

Posts

32.00

Credits

Newbie

Rank: 1

Credits
32.00

 China

Post time: 2020-2-23 23:45:01
| Show all posts
if (confirm ('Are you sure you want to query?'))
{
    __doPostBack ("button1", "");
}
else
{
   __doPostBack ("button2", "");
}

button1, button2 are the ids of the two hidden buttons, and you can add a click event to these two buttons.
Reply

Use magic Report

0

Threads

1

Posts

1.00

Credits

Newbie

Rank: 1

Credits
1.00

 United States

Post time: 2020-2-24 06:06:02
| Show all posts
ajax is probably the best solution to your problem
Reply

Use magic Report

0

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-2-24 07:00:03
| Show all posts
window.returnvalue is the value returned
Reply

Use magic Report

0

Threads

7

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-3-3 12:30:01
| Show all posts
<script language = javascript>
function event1 ()
{
}
function event2 ()
{
}
function click ()
{
    if (confirm ('Are you sure?'))
    {
       event1 ();
    }
    else
    {
        event2 ();
    }
}
</ script>
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