main.jsp:
<html>
<head>
<script type="text/javascript" src="hello.js">
</script>
</head>
<body>
<input type="button" value="test" onclick="hello(this.value)" />
<a onClick="bbb(this)">bbb_ok</a>
<a href onClick="bbb(this)">bbb_ok</a>
<a href="javascript:hello(aa.innerHTML)" id="one">oneoneone...</a>
<script>
var aa = document.getElementById("one");
</script>
</body>
</html>
hello.js
function hello(aaa){
alert(aaa);
alert("haha你好 ");
}
function bbb(str){
alert(str.innerHTML);
}
HTML与JavaScript交互示例
本文介绍了一个简单的HTML页面如何通过内联JavaScript实现按钮点击和链接操作反馈的例子。页面包含一个按钮和几个链接,通过调用JavaScript函数显示弹窗消息。
1075

被折叠的 条评论
为什么被折叠?



