<!-- Begin: AdBrite, Generated: 2009-08-03 19:56:32 -->
<script type="text/javascript">
var AdBrite_Title_Color = '78B749';
var AdBrite_Text_Color = '000000';
var AdBrite_Background_Color = 'FFFFFF';
var AdBrite_Border_Color = 'CCCCCC';
var AdBrite_URL_Color = '0000FF';
try{
var AdBrite_Iframe=window.top!=window.self?2:1;
var AdBrite_Referrer=document.referrer==''?document.location:document.referrer;
AdBrite_Referrer=encodeURIComponent(AdBrite_Referrer);
}catch(e){
var AdBrite_Iframe='';
var AdBrite_Referrer='';
}
</script>
<span style="white-space:nowrap;">
<script type="text/javascript">
document.write(String.fromCharCode(60,83,67,82,73,80,84));
document.write(' src="http://ads.adbrite.com/mb/text_group.php?sid=1287924&zs=3436385f3630&ifr='+AdBrite_Iframe+'&ref='+AdBrite_Referrer+'" type="text/javascript">');
document.write(String.fromCharCode(60,47,83,67,82,73,80,84,62));
</script>
<a target="_top" href="http://www.adbrite.com/mb/commerce/purchase_form.php?opid=1287924&afsid=1">
<img src="http://files.adbrite.com/mb/images/adbrite-your-ad-here-banner.gif" style="background-color:#CCCCCC;border:none;padding:0;margin:0;" alt="Your Ad Here" width="11" height="60" border="0" />
</a>
</span>
<!-- End: AdBrite -->
我需要将所有这些转义为逃脱,我希望它不被javascript解释(我知道它的javascript本身已经,但我把这个代码放在一个不同的javascript文件中,我需要它来停止破坏脚本)。
编辑:stackoverflow切断了一些代码。 = / 转到http://uber-upload.com,查看来源,搜索“center&gt;
答案 0 :(得分:2)
答案 1 :(得分:0)
你能用PHP吗? This SO question有一个函数示例可以解决问题。
答案 2 :(得分:0)
尝试转义双引号..(在vim中:%s /“/ \”/ g )
document.write("var AdBrite_Title_Color = '78B749'; var AdBrite_Text_Color = '000000'; var AdBrite_Background_Color = 'FFFFFF'; var AdBrite_Border_Color = 'CCCCCC'; var AdBrite_URL_Color = '0000FF'; try{var AdBrite_Iframe=window.top!=window.self?2:1;var AdBrite_Referrer=document.referrer==''?document.location:document.referrer;AdBrite_Referrer=encodeURIComponent(AdBrite_Referrer);}catch(e){var AdBrite_Iframe='';var AdBrite_Referrer='';}\n\n"+"document.write(String.fromCharCode(60,83,67,82,73,80,84));document.write(' src=\"http://ads.adbrite.com/mb/text_group.php?sid=1287924&zs=3436385f3630&ifr='+AdBrite_Iframe+'&ref='+AdBrite_Referrer+'\" type=\"text/javascript\">');document.write(String.fromCharCode(60,47,83,67,82,73,80,84,62));");