惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - ㊣阿华

KeyNotFoundException: 给定关键字不在字典中 FastSpring.NET v4.1将使用Spring.NET1.3和NHibernate2.1 - ㊣阿华 FastSpring.NET v4.1 Sample 提供下载(含FastSpring.NETv4.1bin版) Spring.Net & NHibernate 中文论坛重新开放! FastSpring.NET v4.0 Sample 提供下载 母婴网(51muying.Com) [推荐]物流百科-物流行业百科全书 今天收到阿里巴巴 人脉通体验邮件 新注册了个域名alirenmai.com大家看做个什么网站好? 马云涉足SNS社区? alirenmai.com正式启用 - ㊣阿华 ProjectOffice V1.0 提供下载 C#.NET开发的WEB文件管理器下载 ProjectOffice V1.0 重新开始公测 ProjectOfficeV1.0发布(基于FastSpring.NET V3.0开发) FastSpring.NET V2.05 final 发布[集成Spring.net & NHibernate & Ajax] - ㊣阿华 国内第一个支持Spring.NET/NHibernate/Ajax的开源的Framework - ㊣阿华 FastSpring.NET V2.05 RC2 发布 FastNHibernate.NET V1.00 第一个测试版发布(包含全部源代码) - ㊣阿华 FastSpring.NET V2.05 RC1下载地址
如何在新浪博客中添加JavaScript代码
㊣阿华 · 2008-04-30 · via 博客园 - ㊣阿华

新浪博客中不能包含JavaScript代码和IFrame的代码。如果要在博客中加入像Google的广告之类的JavaScript代码,一般的方法是不行的。

今天试了一上午,搞定了。

原理:将JavaScript代码进行

escape加密,放在一个有OnLoad方法的Html标签中,通过OnLoad方法用unescape解密后用eval运行,装载远程的JavaScript文件(js)。这样,无论你要在页面上输出什么内容都可以了。

例如,将下面的奥运倒计时的JavaScript代码加入到博客中:

1. 进入新浪博客管理, 点击“自定义设置”->“首页内容维护”->“-自定义空白面板-”,添加一个自定义的空白面板。

  2. 输入标题如“奥运倒计时”,并点选“显示源代码”,输入以下内容,并保存:

<div id=D2008_YouKu><IMG src="http://www.youku2008.com/2008/0.gif" width=0 onload="eval(unescape('var%20_YouText09%3D%22%3Ciframe%20id%3Dbj2008%20src%3Dhttp%3A//www.youku2008.com/bj2008.html%20width%3D140%20height%3D260%20marginwidth%3D0%20marginheight%3D0%20hspace%3D0%20vspace%3D0%20frameborder%3D0%20scrolling%3Dno%3E%3C/iframe%3E%22%3B%20document.getElementById%28%22D2008_YouKu%22%29.innerHTML%3D%20_YouText09'))" height=0></IMG></div>

3. 点击“设置首页内容”输出到首页就可以了。

得到这段奥运倒计时代码:
http://www.youku2008.com/2008.html

请参见我的新浪博客:
http://blog.sina.com.cn/william716

原文:

http://www.cnblogs.com/it1630/archive/2008/04/30/1177719.html