javascript自定义函数参数传递为字符串格式
更新时间:2014年07月29日 10:05:00 投稿:whsnow
本节主要介绍了通过自定义javascript函数传递参数为字符串格式的,用this传递、引号缺省,示例如下
自定义函数参数传递为 字符串格式 ,传递方式
1:用this传递
2:引号缺省
3:转义字符(html中 " 代表"双引号,'代表单引号,javascript中直接\" 和Java通用转义字符集)
<html>
<head>
<script language="LiveScript">
function print(arg){
alert("你好!"+arg);
}
</script>
</head>
<body>
<form>
<input type="button" name="Button1" value="first" onclick="print(this.str)" str="你好one">
<br><br>
<input type="button" name="button2" value="second" onclick=print("你好two")>
<br><br>
<input type="button" name="button3" value="Third" onclick="print ("你好three")">
</form>
</body>
</html>
相关文章
详解JavaScript原生封装ajax请求和Jquery中的ajax请求
在本篇文章中我们总结了关于JavaScript原生封装ajax请求和Jquery中的ajax请求的知识点内容,需要的朋友们学习参考下。2019-02-02
use jscript Create a SQL Server database
use jscript Create a SQL Server database...2007-06-06


最新评论