javascript自定义函数参数传递为字符串格式
作者:whsnow 时间:2024-04-22 13:08:18
自定义函数参数传递为 字符串格式 ,传递方式
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>
标签:参数传递,字符串格式
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python调用百度AI接口实现人流量统计
2022-09-10 12:46:27
![](https://img.aspxhome.com/file/2023/8/77688_0s.png)
javascript实现滚动效果的数字时钟实例
2024-04-29 13:39:50
![](https://img.aspxhome.com/file/2023/9/132599_0s.jpg)
简述php环境搭建与配置
2023-11-15 09:08:28
浅谈编码,解码,乱码的问题
2021-02-22 05:15:37
![](https://img.aspxhome.com/file/2023/0/120960_0s.jpg)
解决python 打包成exe太大的问题
2021-09-22 11:33:59
![](https://img.aspxhome.com/file/2023/8/115418_0s.jpg)
Python 匹配任意字符(包括换行符)的正则表达式写法
2023-01-23 23:11:09
Python中整数的缓存机制讲解
2021-12-24 12:35:46
golang与pgsql交互的实现
2024-05-25 15:11:52
![](https://img.aspxhome.com/file/2023/4/123954_0s.png)
Python FTP操作类代码分享
2022-09-07 17:59:23
UTF-8 GBK UTF8 GB2312 之间的区别和关系介绍
2022-06-12 12:15:46
SQL Server数据库的三种创建方法汇总
2024-01-19 01:20:24
![](https://img.aspxhome.com/file/2023/5/116285_0s.png)
python3 中时间戳、时间、日期的转换和加减操作
2023-12-31 17:41:36
Mysql存储过程学习笔记--建立简单的存储过程
2024-01-23 14:41:21
![](https://img.aspxhome.com/file/2023/0/71120_0s.png)
Python Pandas读取Excel日期数据的异常处理方法
2021-12-10 11:22:55
![](https://img.aspxhome.com/file/2023/6/75386_0s.png)
Autopep8的使用(python自动编排工具)
2022-07-04 11:10:47
![](https://img.aspxhome.com/file/2023/7/96967_0s.png)
Python爬虫基础之requestes模块
2022-04-24 20:20:15
![](https://img.aspxhome.com/file/2023/3/83943_0s.png)
已安装tensorflow-gpu,但keras无法使用GPU加速的解决
2021-08-15 12:17:42
![](https://img.aspxhome.com/file/2023/6/81736_0s.jpg)
对python使用http、https代理的实例讲解
2022-03-13 00:03:08
程序员趣味读物 谈谈Unicode编码
2023-03-19 14:56:13
mac 上配置Pycharm连接远程服务器并实现使用远程服务器Python解释器的方法
2021-10-19 18:40:40
![](https://img.aspxhome.com/file/2023/8/127318_0s.png)