JavaScript用函数传递的几种参数

来源:互联网 发布:贵州卫计委网络直报 编辑:程序博客网 时间:2024/06/04 20:15

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);
}

0 0
原创粉丝点击