[代码] [JavaScript]代码
var Ajax={};
Ajax._xmlHttp = function(){ return new (window.ActiveXObject||window.XMLHttpRequest)("Microsoft.XMLHTTP");}
Ajax._AddEventToXHP = function(xhp,fun,isxml){
xhp.onreadystatechange=function(){
if(xhp.readyState==4&&xhp.status==200)
fun(isxml?xhp.responseXML:xhp.responseText);
}
}
Ajax.get=function(url,fun,isxml,bool){
var _xhp = this._xmlHttp();
this._AddEventToXHP(_xhp, fun || function(){} ,isxml);
_xhp.open("GET",url,bool);
_xhp.send(null);
}
一段很简洁很棒的原生态javascript的Ajax代码 23 January 2012 17:33 Monday by 小屋 浏览(428)
js利用google翻译接口把网页翻译成各国语言 13 April 2011 16:09 Wednesday by小屋 浏览(3277)
网页翻译为德语(Translate Page To German)
<a href="javascript: void(window.open('http://translate.google.com/translate?u='+escape(location.href)+'&langpair=en%7Cde', 'English_to_German', 'resizable,scrollbars,status'))">网页翻译为德语(Translate Page To German)</a>
网页翻译为西班牙语(Translate Page To Spanish)
<a href="javascript: void(window.open('http://translate.google.com/translate?u='+escape(location.href)+'&langpair=en%7Ces', 'English_to_Spanish', 'resizable,scrollbars,status'))">网页翻译为西班牙语(Translate Page To Spanish)</a>
js - 刷新框架及页面的方法总结 03 November 2010 16:32 Wednesday by小屋 浏览(2209)
看一个简单的例子:
下面以三个页面分别命名为frame.html 、top.html 、bottom.html 为例来具体说明如何做。
frame.html 由上(top.html)下(bottom.html)两个页面组成,代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> frame </TITLE>
</HEAD>
<frameset rows="50%,50%">
<frame name=top src="top.html">
<frame name=bottom src="bottom.html">
</frameset>
</HTML>
现 在假设top.html (即上面的页面) 有七个button来实现对bottom.html (即下面的页面) 的刷新,可以用以下七种语句,哪个好用自己看着办
又一枚iframe高度自适应代码 - (兼容FF,Opera,Safari多浏览器) 05 October 2010 15:38 Tuesday by小屋 浏览(2166)
- <script type="text/javascript">
- function SetCwinHeight(iframeObj){
- if (document.getElementById){
- if (iframeObj){
- if (iframeObj.contentDocument && iframeObj.contentDocument.body.offsetHeight){
- iframeObj.height = iframeObj.contentDocument.body.offsetHeight;
- } else if (document.frames[iframeObj.name].document && document.frames
- [iframeObj.name].document.body.scrollHeight){ iframeObj.height = document.frames
- [iframeObj.name].docum
利用 javascript实现web页面刷新方法 - 总结 17 August 2010 15:29 Tuesday by小屋 浏览(2068)
Javascript刷新页面的几种方法:
1 history.go(0)
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7 location.replace(location)
8 document.URL=location.href
自动刷新页面的方法:
1. 页面自动刷新:把如下代码加入<head>区域中
<meta http-equiv="refresh" content="20">
其中20指每隔20秒刷新一次页面.
2. 页面自动跳转:把如下代码加入<he