如何处理中的body onload事件标签
我在我们的应用程序中使用 sitemesh。在装饰器jsp中,我在head和body标签中添加了
:
<body onload="<decorator:getProperty property='body.onload'/>" >
所以我想在我的jsp页面上处理bodyonload
。 我添加了以下内容:
<script type="text/javascript">
function init() {
alert("hi");
}
</script>
</head>
<body onload="javascript:init();">
但是 init()
在我的 jsp 页面中不起作用。
I am using sitemesh in our application. In decorator jsp I have added <decorator:head>
in head and on body tag:
<body onload="<decorator:getProperty property='body.onload'/>" >
So I want to handle body onload
on my jsp page.
I have added following things:
<script type="text/javascript">
function init() {
alert("hi");
}
</script>
</head>
<body onload="javascript:init();">
But init()
does not worked in my jsp page.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不将其全部粘贴到
script
元素中呢?比乱搞元素属性要干净得多:或者,保留
init
声明:Why not just stick it all into the
script
element? Much cleaner than mucking about with element attributes:Or, alternatively, keeping the
init
declaration:试试这个
try this