现在我收到以下错误:';'预期
document.write("<script type='text/javascript'>var twitterwind_option = {'isOnlyMe':true,'twitterwind_logo':'','twitterwind_logo_bgcolor':'FFFFFF','twitterwind_logo_color':'333303','followers_color':'000000','followers_bgcolor':'FFFFFF','twitterwind_max_length':'39','twitterwind_username':'table-row','twitterwind_username_color':'333333','twitterwind_username_bgcolor':'FFFFFF','twitterwind_twit':'block','twitterwind_twit_color':'333333','twitterwind_twit_bgcolor':'FFFFFF','twitterwind_twit_link_color':'0084B4','twitterwind_twit_scroll_color':'C0DEED','twitterwind_twit_scroll_bg_color':'FFFFFF','twitterwind_follower':'inherit','twitterwind_follower_bgcolor':'FFFFFF','twitterwind_frame_width':200,'twitterwind_frame_height':480,'twitterwind_frame_border':'false','twitterwind_frame_border_color':'C0DEED','twitterwind_base_font_size':12,'twitterwind_me_font_size':14,'twitterwind_caption_font_size':16,'twitterwind_scroll_height':336,'eusn':'rdK1y36H5sM='}';var twitterwind_url = 'http://www.tweetswind.com/en/twitterwind.php';<\/script><script type='text/javascript' src='http://www.tweetswind.com/en/js/twitterwind.js'><\/script><div style='font-size:12px; text-align:right; width:200px'><a target='_blank' href='http://www.tweetswind.com/en/en/'>TweetsWind: a Twitter widget</a></div>");src='http://www.tweetswind.com/en/js/twitterwind.js'></script><div style='font-size:12px; text-align:right; width:200px'><a target='_blank' href='http://www.tweetswind.com/en/en/'>TweetsWind: a Twitter widget</a></div>");
答案 0 :(得分:2)
1。
var twitterwind_option = '{'isOnlyMe' ... }';var twitterwind_url
需要
var twitterwind_option = \"{'isOnlyMe' ... }\";var twitterwind_url
2。
"twitterwind_twit_scroll_color:"C0DEED",
需要
"twitterwind_twit_scroll_color":"C0DEED",
3。逃离</script>
至<\/script>
以下是工作版DEMO
document.write('<script type="text/javascript"> window.twitterwind_option = \'{ "isOnlyMe":true, "twitterwind_logo":"", "twitterwind_logo_bgcolor":"FFFFFF", "twitterwind_logo_color":"333303", "followers_color":"000000", "followers_bgcolor":"FFFFFF", "twitterwind_max_length":"39", "twitterwind_username":"table-row", "twitterwind_username_color":"333333", "twitterwind_username_bgcolor":"FFFFFF", "twitterwind_twit":"block", "twitterwind_twit_color":"333333", "twitterwind_twit_bgcolor":"FFFFFF", "twitterwind_twit_link_color":"0084B4", "twitterwind_twit_scroll_color":"C0DEED", "twitterwind_twit_scroll_bg_color":"FFFFFF", "twitterwind_follower":"inherit", "twitterwind_follower_bgcolor":"FFFFFF", "twitterwind_frame_width":200, "twitterwind_frame_height":480, "twitterwind_frame_border":"false", "twitterwind_frame_border_color":"C0DEED", "twitterwind_base_font_size":"12", "twitterwind_me_font_size":14, "twitterwind_caption_font_size":16, "twitterwind_scroll_height":336, "eusn":"rdK1y36H5sM="}\'; var twitterwind_url = "http://www.tweetswind.com/en/twitterwind.php";<\/script> <script type="text/javascript" src="http://www.tweetswind.com/en/js/twitterwind.js"><\/script> <div style="font-size:12px; text-align:right; width:200px"><a target="_blank" href="http://www.tweetswind.com/en/en/">TweetsWind: a Twitter widget</a></div>')
还要确保在页面呈现后不进行document.write
<body>
<script>
document.write(...)
</script>
</body>
没问题,但事实并非如此:
<head>
<script>
window.onload=function() {
document.write(...)
}
</script>
<body>
</body>