<script type="text/javascript">
function getCookie( name ) {
var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
if( arr != null )
{
return decodeURIComponent( arr[ 2 ] );
}
return null;
}function csdnShowSpaceNotify( data ) {
document.getElementById("header_notice_num").innerHTML = parseInt( data.n ) > 0 ? data.n : 0;
if( parseInt( data.l ) > 0 )
{
document.getElementById("header_letter_num").innerHTML = "("+data.l+")";
}
}
window.csdnShowSpaceNotify = csdnShowSpaceNotify;var userName = getCookie( "UserNick" );
if ( userName && userName != "Guest" )
{
document.getElementById("login").innerHTML = "";
document.getElementById("showinfo").innerHTML = "<em>"+ userName + "</em><a href=\"http://notify.csdn.net/dashboard\" class=\"notice_num\" id=\"header_notice_num\"></a>我的:<a href=\"http://my.csdn.net/my/letter\">收件箱<span id=\"header_letter_num\"></span></a><a href='http://download.csdn.net/my' class='red'>资源</a> <a href='http://write.blog.csdn.net/' class='red'>博客</a> <a href='http://my.csdn.net/'>空间</a> <a href='https://passport.csdn.net/account/profile'>设置</a>| <a href='https://passport.csdn.net/help/faq'>帮助</a>| <a href='http://passport.csdn.net/account/logout'>退出</a><input type='text' name='passwordtwo' class='search' value='搜索' onfocus=\"if(this.value=='搜索') this.value='';this.style.color='#333'; return true;\" onblur=\"if(this.value=='') this.value='搜索'; this.style.color='#999'; return true;\" id='srch1' />";
}if ( userName && userName != "Guest" )
{
( function() {
var ca = document.createElement( 'script' );
ca.type = 'text/javascript';
ca.async = true;
ca.src = 'http://my.csdn.net/index.php/service/notifications/getnl?jsonpcallback=csdnShowSpaceNotify';
var s = document.getElementsByTagName( 'script' )[ 0 ];
s.parentNode.insertBefore( ca, s );
} )();
}
function getCookie( name ) {
var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
if( arr != null )
{
return decodeURIComponent( arr[ 2 ] );
}
return null;
}function csdnShowSpaceNotify( data ) {
document.getElementById("header_notice_num").innerHTML = parseInt( data.n ) > 0 ? data.n : 0;
if( parseInt( data.l ) > 0 )
{
document.getElementById("header_letter_num").innerHTML = "("+data.l+")";
}
}
window.csdnShowSpaceNotify = csdnShowSpaceNotify;var userName = getCookie( "UserNick" );
if ( userName && userName != "Guest" )
{
document.getElementById("login").innerHTML = "";
document.getElementById("showinfo").innerHTML = "<em>"+ userName + "</em><a href=\"http://notify.csdn.net/dashboard\" class=\"notice_num\" id=\"header_notice_num\"></a>我的:<a href=\"http://my.csdn.net/my/letter\">收件箱<span id=\"header_letter_num\"></span></a><a href='http://download.csdn.net/my' class='red'>资源</a> <a href='http://write.blog.csdn.net/' class='red'>博客</a> <a href='http://my.csdn.net/'>空间</a> <a href='https://passport.csdn.net/account/profile'>设置</a>| <a href='https://passport.csdn.net/help/faq'>帮助</a>| <a href='http://passport.csdn.net/account/logout'>退出</a><input type='text' name='passwordtwo' class='search' value='搜索' onfocus=\"if(this.value=='搜索') this.value='';this.style.color='#333'; return true;\" onblur=\"if(this.value=='') this.value='搜索'; this.style.color='#999'; return true;\" id='srch1' />";
}if ( userName && userName != "Guest" )
{
( function() {
var ca = document.createElement( 'script' );
ca.type = 'text/javascript';
ca.async = true;
ca.src = 'http://my.csdn.net/index.php/service/notifications/getnl?jsonpcallback=csdnShowSpaceNotify';
var s = document.getElementsByTagName( 'script' )[ 0 ];
s.parentNode.insertBefore( ca, s );
} )();
}
解决方案 »
- Js如何把一篇英文文章拆分成单词保存
- php+ajax验证用户名是否被注册 帮忙解决下
- 大家好,想问一个HTML的布局事。。。
- 高手救命?类似于3721拖动DIV的层问题?
- 下拉列表框调用不同的css样式表,如何可以记住它选择的样式,是用cookie吗?
- 诚求不间断图片滚动代码
- 定义表单的一个语句:<form method=post action=regist.jsp name=form1
- 加了return效果一样
- 请教关于下拉菜单和textarea 连动的效果
- 这个jquery要怎么兼容呢?iframe获取父窗口中的元素
- 今天无聊javascript写了一个可以监听函数的小插件 新手
- jquery 怎么获取整个表单验证的结果
15行,2个空格缩进。下面的又都是2个空格缩进。
<script type="text/javascript">
//google计数器
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-535605-6']);
_gaq.push(['_setDomainName', 'csdn.net']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>感觉编码规范上淘宝要做得好些。
但taobao上还是有var obj = {
key: "val"
}
注意,最后没“;”号, key没双引号。
4行 14行,if后没空格。 我这里要求带空格就退回重做js 中, ; 本来就是可以被省略的key 只有json格式才严格规定必须加引号,对于一个对象来说,本来就没严格规定,我这边为了区别 json 和对象的概念,要求对象的key必须不能用引号楼主强迫症,应该要立刻看心理医生,快回家吃药
gweb.dom.getElement('download-versions-alt').style.display = 'none'; var winEl = gweb.dom.getElement('download-win'),
win2kEl = gweb.dom.getElement('download-win2k'),
otherEl = gweb.dom.getElement('download-others');
var vStandardEl = gweb.dom.getElement('version-standard'),
vClassicEl = gweb.dom.getElement('version-classic');
var vStandardUrl = gweb.dom.getElement('link-standard') && gweb.dom.getElement('link-standard').href,
vClassicUrl = gweb.dom.getElement('link-classic') && gweb.dom.getElement('link-classic').href;
var downloadButton = gweb.dom.getElementsByTagNameAndClass('a', '', winEl)[0];
var downloadVersions = gweb.dom.getElement('download-versions');
var ua = navigator.userAgent; // System detection.
if (location.href.indexOf('rd=f') == -1) {
if (ua.indexOf('Win') == -1) {
winEl.style.display = 'none';
otherEl.style.display = 'block';
} else {
// Detect Windows 2000.
if (ua.indexOf('Windows NT 5.0') != -1 && win2kEl) {
winEl.style.display = 'none';
win2kEl.style.display = 'block';
}
}
} // Change download button's link based on which version selected.
downloadVersions.style.display = 'block';
gweb.events.listen(downloadVersions, 'click', function(e) {
if (vClassicEl && vClassicEl.checked) {
downloadButton.href = vClassicUrl;
} else {
downloadButton.href = vStandardUrl;
}
});我不承认我在钓鱼。