我有一个 php 脚本,可以在我的服务器上上传 mp3 文件。我使用“上传”。有一个事件“onSelect”(文档 http://www.uploadify.com/documentation/events/onselect/),当文件上传时调用。使用它我想在每个文件上传后动态刷新播放列表。
但我的“onselect”字段中的函数抛出错误“未终止的字符串文字”。经过长时间的搜索,我将单行函数改为多行函数(为了方便起见,已在此处添加断线)并在双引号前添加斜杠。
function() {$('#response').append("
<script type=\"text/javascript\">
var flashvars = {url:'./media/audio/users/126/md6xs4cv8ks0.mp3',artist:'Undef', track:'Undef', duration:''};
var Params = {};
var attributes = {};
swfobject.embedSWF(\"min.swf\", \"myAlternativeContent1\", \"320\", \"40\", \"9.0.0\", false, flashvars, params, attributes);
</script>
<div id="myAlternativeContent1">
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
</div>
与其他答案相反,字符串文字can包含换行符,它们只需要使用反斜杠进行转义,如下所示:
var string = "hello\
world!";
但是,这不会在字符串中创建换行符,因为它必须是显式的\n
转义序列。这在技术上将成为helloworld
. Doing
var string = "hello"
+ "world"
会干净得多
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)