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

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

WBOY
WBOYOriginal
2016-06-23 14:24:591027browse

$aa=""


那个SZ怎么输出单引号?


回复讨论(解决方案)

用转义符 \

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

加个转义符号  \   就可以了

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

用转义符 \

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


这个是正解

用转义符 \

二楼说的对,用转义字符

Statement:
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