开发者

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜