Home > Backend Development > PHP Tutorial > 字符串输出onclick事件,怎么加单引号

字符串输出onclick事件,怎么加单引号

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 14:24:59
Original
1104 people have browsed it

$aa=""


那个SZ怎么输出单引号?


回复讨论(解决方案)

用转义符 \

<?php$aa="<input class='btn btn-primary' onClick=\"alert('SZ')\" id='mergeraddress' name='mergeraddress' type='submit' value='合并发货地址标签' />";echo $aa;?>
Copy after login
Copy after login

加个转义符号 \ 就可以了

$aa="<input class='btn btn-primary' onClick='mergeraddress(\'SZ\')' id='mergeraddress' name='mergeraddress' type='submit' value='合并发货地址标签' />"echo $aa;
Copy after login

用转义符 \

<?php$aa="<input class='btn btn-primary' onClick=\"alert('SZ')\" id='mergeraddress' name='mergeraddress' type='submit' value='合并发货地址标签' />";echo $aa;?>
Copy after login
Copy after login


这个是正解

用转义符 \

二楼说的对,用转义字符

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template