分页: 1 / 1

【180天180个网站】第三天(下)

发表于 : 2015-01-25 17:42
挨踢大臣

Re: 【180天180个网站】第三天(下)

发表于 : 2015-01-25 18:03
hoxily
$(document).ready(function () {
function mychange () { alert("hello"); }
$('#button2').on('click', mychange);
});

Re: 【180天180个网站】第三天(下)

发表于 : 2015-01-25 18:36
hoxily
在javascript中,单引号与双引号效果一样,都用于限定字符串常量。
如果字符串中只含有单引号时,可以用双引号包裹;反之用单引号包裹。像下面这样:

代码: 全选

s1 = '"How are you?" Tom asked.';

代码: 全选

s2 = "a single quote(') in string constant.";
当字符串内容既有单引号,又有双引号时,只能用反斜杠(\)来转义表达了,如下:

代码: 全选

s3 = 'a string contains single quote(\') and double quote(").';

代码: 全选

s4 = "a string contains single quote(') and double quote(\").";