| |

VerySource

 Forgot password?
 Register
Search
Author: fat841008

Regarding calling the onload attribute in the struts tag, thank you

[Copy link]

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-5 20:15:01
| Show all posts
I don't quite understand what lz wants to ask? One of my understanding is:

Method in <body onload=a()>: a()
LZ wants to call a() in the Struts tag

First of all, you can think of the above, add the definition of method a() on the jsp page
<script language="JavaScript">
function a(){........}
</script>

Then, call the method a() in the struts tag of the page
Example: <html:button property="aaa" onclick="a()" />

PS: <body onload="a()"> means to call a() when the page is loaded
    The above example calls a() when the button is pressed
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 Singapore

 Author| Post time: 2020-8-6 08:45:01
| Show all posts
<html:form .... body onload="a()"/>
It will produce an error saying that the body onload attribute cannot be found.
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-6 18:00:01
| Show all posts
The onload attribute is in the body tag, which is the content of html, not in the Struts tag
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function c()
{
//content
}
</SCRIPT>
</HEAD>
<body onload=a()>
<html:form action=.. method=..>
//Content in the form
</html:form>
</body>
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-6 20:30:01
| Show all posts
You write a piece of js code on the page, and then add it to <html:form action="" onload="function name"/>, it’s fine.
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-6 22:00:02
| Show all posts
....
<html>
<head>

</head>
<script language="javascript">
function a(){
//Omitted. . .
}
</script>
<body onload="a()">
</body>
</html>

The onload attribute is an attribute of the body and cannot be included in the form. Ha ha...
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