Unable to document.write on this code
Which code do I need to fix? Thank!
document.write('
var parameters =
{ id: "1开发者_开发技巧"
, src: "<?php echo $source?>"
, autoPlay: "false"
, width: "638"
, height: "400"
, autoHideControlBar: "false"
, controlBarPosition: "bottom"
};
swfobject.embedSWF
( "vcp.swf"
, "player"
, parameters["width"], parameters["height"]
, "10"
, {}
, parameters
, { allowFullScreen: "true" }
, { name: "sMPlayback" }
);
');
You can't have new-lines in a string like you have, the string you're passing to document.write()
has them...but since you're in the page, just remove the document.write
, so your result should just be this:
<script type="text/javascript">
var parameters =
{ id: "1"
, src: "<?php echo $source?>"
, autoPlay: "false"
, width: "638"
, height: "400"
, autoHideControlBar: "false"
, controlBarPosition: "bottom"
};
swfobject.embedSWF
( "vcp.swf"
, "player"
, parameters["width"], parameters["height"]
, "10"
, {}
, parameters
, { allowFullScreen: "true" }
, { name: "sMPlayback" }
);
</script>
精彩评论