//1.用单双引号拼接 var valueDemo = "111"; var htmlStrs1 = '<option selected="selected" value="'+valueDemo+'"></option>'; alert(htmlStrs1); //2.通过转义字符拼接 var htmlStrs2 = "<option selected=\"selected\" val
今天在操作一个元素时,id值是拼接的. var index = $(this).attr(‘index’); //0var id = ‘#’ + (index+1); //#01$(id).attr(‘style’,”); 正确处理:parseInt函数 var index = parseInt($(this).attr(‘index’)); //0var id = ‘#’ + (index+1); //#1$(id).attr(‘style’,”);
在C语言中,我们使用printf("%s","hello")这种形式进行字符串的拼接 在python中,进行这样的拼接有两种实现方式,分别是%号拼接以及使用format函数,以下进行代码演示 %号拼接字符串 在python中是用%号可以进行字符串的拼接,这个跟print函数是无关的.以下进行举例 打印字符串 msg = "i am %s,my blogs is %s" % ("CodeScrew","www.cnbl