📄 prototype中tojson的用法.mht
字号:
function ms_dispnav()
{
if(arguments.length < 2)return;
var tell =3D arguments[0];
for(var i =3D 1; i < arguments.length; i++)
{
var nav =3D document.getElementById(arguments[i] + "_nav");
var content =3D document.getElementById(arguments[i] + "_content");
if(!nav || !content)continue;
if(tell =3D=3D i)
{
nav.className =3D i =3D=3D arguments.length - 1 ? "active end" : =
"active";
content.style.display =3D "";
}
else
{
nav.className =3D i =3D=3D arguments.length - 1 ? "normal end" : =
"normal";
content.style.display =3D "none";
}
}
}
function updataip(ip)
{
ms_dispnav(2,'ipsearch','ipsubmit','websearch');
var theform =3D document.forms['ipsubmit'];
theform.elements["upip"].value =3D ip;
theform.elements["upaddr"].focus();
}
function setTransition(){
if (document.all){
=
bannerADrotator.filters.revealTrans.Transition=3DMath.floor(Math.random()=
*23);
bannerADrotator.filters.revealTrans.apply();
}
}
=09
function playTransition(){
if (document.all)
bannerADrotator.filters.revealTrans.play()
}
function show(n,url)
{
t=3DadNum+1;
document.getElementById("pic_"+t).className=3D"picpage"; =20
document.getElementById("pic_"+n).className=3D"picaction";
if(n=3D=3D0)
{
adNum=3D0;
}else
adNum=3Dn-1; =20
document.images.bannerADrotator.src=3Durl; =20
document.getElementById("pmsg").innerHTML=3DbannerADtext[adNum];
}
function nextAd(){
if(adNum<bannerAD.length-1)adNum++ ;
else adNum=3D0;
setTransition();
document.images.bannerADrotator.src=3DbannerAD[adNum];
playTransition();
document.getElementById("pmsg").innerHTML=3DbannerADtext[adNum];
=20
if(adNum=3D=3D0)
{
t=3DbannerAD.length;
if(document.getElementById("pic_"+t))
document.getElementById("pic_"+t).className=3D"picpage";
}else
{
if(document.getElementById("pic_"+adNum))
document.getElementById("pic_"+adNum).className=3D"picpage";
}
t=3DadNum+1;
if(document.getElementById("pic_"+t))
document.getElementById("pic_"+t).className=3D"picaction";
theTimer=3DsetTimeout("nextAd()", 5000); =09
}
function clearad()
{
if(kad=3D=3D1)
{
nextAd();
kad=3D0;
}else{
clearTimeout(theTimer);
kad=3D1;
}
}
function jump2url(){
jumpUrl=3DbannerADlink[adNum];
jumpTarget=3D'_blank';
if (jumpUrl !=3D ''){
if (jumpTarget !=3D '')window.open(jumpUrl,jumpTarget);
else location.href=3DjumpUrl;
}
return false;
}
function displayStatusMsg() {=20
status=3DbannerADlink[adNum];
document.returnValue =3D true;
}
function avpic(n,url)
{
if(n=3D=3D0)
{
adNum=3D0;
}else
adNum=3Dn-1; =20
document.images.bannerADrotator.src=3Durl; =20
document.getElementById("pmsg").innerHTML=3DbannerADtext[n];
return false;
}
function nextshow()
{
adNum=3DadNum+1; =20
if(adNum>=3DbannerAD.length)
{
adNum=3D0;
}
document.images.bannerADrotator.src=3DbannerAD[adNum]; =20
document.getElementById("pmsg").innerHTML=3DbannerADtext[adNum];
}
function addloadEvent(func)
{
var oldonload=3Dwindow.onload;
if(typeof window.onload!=3D'function')
{
window.onload=3Dfunc;
}else
{
window.onload=3Dfunction(){
oldonload();
func();
}
}
}
function getMonth(year,month)
{
=
jQuery.ajax({url:"/myblog/calendar/"+year+"_"+month+".html",success:funct=
ion(msg){ jQuery("#blogCalender").html(msg); }});
return false;
}
/* addEvent: simplified event attachment */
function addEvent( obj, type, fn ) {
if (obj.addEventListener) {
obj.addEventListener( type, fn, false );
EventCache.add(obj, type, fn);
}
else if (obj.attachEvent) {
obj["e"+type+fn] =3D fn;
obj[type+fn] =3D function() { obj["e"+type+fn]( window.event ); }
obj.attachEvent( "on"+type, obj[type+fn] );
EventCache.add(obj, type, fn);
}
else {
obj["on"+type] =3D obj["e"+type+fn];
}
}
=09
var EventCache =3D function(){
var listEvents =3D [];
return {
listEvents : listEvents,
add : function(node, sEventName, fHandler){
listEvents.push(arguments);
},
flush : function(){
var i, item;
for(i =3D listEvents.length - 1; i >=3D 0; i =3D i - 1){
item =3D listEvents[i];
if(item[0].removeEventListener){
item[0].removeEventListener(item[1], item[2], item[3]);
};
if(item[1].substring(0, 2) !=3D "on"){
item[1] =3D "on" + item[1];
};
if(item[0].detachEvent){
item[0].detachEvent(item[1], item[2]);
};
item[0][item[1]] =3D null;
};
}
};
}();
addEvent(window,'unload',EventCache.flush);
/* grab Elements from the DOM by className */
function getElementsByClass(searchClass,node,tag) {
var classElements =3D new Array();
if ( node =3D=3D null )
node =3D document;
if ( tag =3D=3D null )
tag =3D '*';
var els =3D node.getElementsByTagName(tag);
var elsLen =3D els.length;
var pattern =3D new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
for (i =3D 0, j =3D 0; i < elsLen; i++) {
if ( pattern.test(els[i].className) ) {
classElements[j] =3D els[i];
j++;
}
}
return classElements;
}
/* toggle an element's display */
function toggle(obj) {
var el =3D document.getElementById(obj);
if ( el.style.display !=3D 'none' ) {
el.style.display =3D 'none';
}
else {
el.style.display =3D '';
}
}
/* insert an element after a particular node */
function insertAfter(parent, node, referenceNode) {
parent.insertBefore(node, referenceNode.nextSibling);
}
/* Array prototype, matches value in array: returns bool */
Array.prototype.inArray =3D function (value) {
var i;
for (i=3D0; i < this.length; i++) {
if (this[i] =3D=3D=3D value) {
return true;
}
}
return false;
};
/* get, set, and delete cookies */
function getCookie( name ) {
var start =3D document.cookie.indexOf( name + "=3D" );
var len =3D start + name.length + 1;
if ( ( !start ) && ( name !=3D document.cookie.substring( 0, =
name.length ) ) ) {
return null;
}
if ( start =3D=3D -1 ) return null;
var end =3D document.cookie.indexOf( ";", len );
if ( end =3D=3D -1 ) end =3D document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}
=09
function setCookie( name, value, expires, path, domain, secure ) {
var today =3D new Date();
today.setTime( today.getTime() );
if ( expires ) {
expires =3D expires * 1000 * 60 * 60 * 24;
}
var expires_date =3D new Date( today.getTime() + (expires) );
document.cookie =3D name+"=3D"+escape( value ) +
( ( expires ) ? ";expires=3D"+expires_date.toGMTString() : "" ) + =
//expires.toGMTString()
( ( path ) ? ";path=3D" + path : "" ) +
( ( domain ) ? ";domain=3D" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
=09
function deleteCookie( name, path, domain ) {
if ( getCookie( name ) ) document.cookie =3D name + "=3D" +
( ( path ) ? ";path=3D" + path : "") +
( ( domain ) ? ";domain=3D" + domain : "" ) +
";expires=3DThu, 01-Jan-1970 00:00:01 GMT";
}
/* quick getElement reference */
function analyse()
{
=
document.body.style.backgroundImage=3D"url(/myblog/images/"+Math.floor(Ma=
th.random()*5)+".jpg)";
var agent=3Dnew Array();
if(jQuery.browser.msie)
{
agent['browser']=3D"ie";
}else if(jQuery.browser.mozilla)
{
agent['browser']=3D"mozilla";
}else{
agent['browser']=3D"other";
}
agent['version']=3DjQuery.browser.version;
agent['width']=3Dwindow.screen.width;
agent['height']=3Dwindow.screen.height;
agent['url']=3DencodeURIComponent(window.location.href);
agent['referrer']=3DencodeURIComponent(window.document.referrer);
=
jQuery.get("/myblog/analyse.php",{browser:agent['browser'],version:agent[=
'version'],width:agent['width'],height:agent['height'],href:agent['url'],=
referrer:agent['referrer']});
}
addloadEvent(analyse);
function inputclass()
{
=09
if (jQuery.browser.msie){
jQuery("input[@type=3D'text'], input[@type=3D'password'], =
textarea").focus(function(){jQuery(this).css({background:"#fcc", =
border:"1px solid =
#f00"})}).blur(function(){jQuery(this).css({background: "url() none =
repeat scroll 0%", border: "1px solid #ccc"})});
}
=20
}
addloadEvent(inputclass);
addloadEvent(resultpage);
function resultpage()
{
if(document.getElementById("page0"))
{
var $page;
pagetotalnum++;
for($i=3D0;$i<11;$i++)
{
if(!document.getElementById("page"+$i)) continue;
=20
$page=3Ddocument.getElementById("page"+$i).innerHTML;
document.getElementById("page"+$i).innerHTML=3Dpagetotalnum-$page;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -