锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
document.title //璁劇疆鏂囨。鏍囬絳変環浜嶩TML鐨?lt;title>鏍囩
document.bgColor //璁劇疆欏甸潰鑳屾櫙鑹?/font>
document.fgColor //璁劇疆鍓嶆櫙鑹?鏂囨湰棰滆壊)
document.linkColor //鏈偣鍑昏繃鐨勯摼鎺ラ鑹?/font>
document.alinkColor //嬋媧婚摼鎺?鐒︾偣鍦ㄦ閾炬帴涓?鐨勯鑹?/font>
document.vlinkColor //宸茬偣鍑昏繃鐨勯摼鎺ラ鑹?/font>
document.URL //璁劇疆URL灞炴т粠鑰屽湪鍚屼竴紿楀彛鎵撳紑鍙︿竴緗戦〉
document.fileCreatedDate //鏂囦歡寤虹珛鏃ユ湡錛屽彧璇誨睘鎬?/font>
document.fileModifiedDate //鏂囦歡淇敼鏃ユ湡錛屽彧璇誨睘鎬?/font>
document.fileSize //鏂囦歡澶у皬錛屽彧璇誨睘鎬?/font>
document.cookie //璁劇疆鍜岃鍑篶ookie
document.charset //璁劇疆瀛楃闆?綆浣撲腑鏂?gb2312
Javascript Document瀵硅薄鏂規硶
document.write() //鍔ㄦ佸悜欏甸潰鍐欏叆鍐呭
document.createElement(Tag) //鍒涘緩涓涓猦tml鏍囩瀵硅薄
document.getElementById(ID) //鑾峰緱鎸囧畾ID鍊肩殑瀵硅薄
document.getElementsByName(Name) //鑾峰緱鎸囧畾Name鍊肩殑瀵硅薄
javascript document images闆嗗悎(欏甸潰涓殑鍥捐薄)
a)閫氳繃闆嗗悎寮曠敤
document.images //瀵瑰簲欏甸潰涓婄殑<img>鏍囩
document.images.length //瀵瑰簲欏甸潰涓?lt;img>鏍囩鐨勪釜鏁?/p>
document.images[0] //絎?涓?lt;img>鏍囩
document.images[i] //絎琲-1涓?lt;img>鏍囩
b)閫氳繃nane灞炴х洿鎺ュ紩鐢?/p>
<img name="oImage">
document.images.oImage //document.images.name灞炴?/p>
c)寮曠敤鍥劇墖鐨剆rc灞炴?/p>
document.images.oImage.src //document.images.name灞炴?src
d)鍒涘緩涓涓浘璞?/p>
var oImage
oImage = new Image()
document.images.oImage.src="/1.jpg"
//鍚屾椂鍦ㄩ〉闈笂寤虹珛涓涓?lt;img>鏍囩涓庝箣瀵瑰簲灝卞彲浠ユ樉紺?/p>
<html>
<img name=oImage>
<script language="javascript">
var oImage
oImage = new Image()
document.images.oImage.src="/1.jpg"
</script>
</html>
forms闆嗗悎(欏甸潰涓殑琛ㄥ崟)
a)閫氳繃闆嗗悎寮曠敤
document.forms //瀵瑰簲欏甸潰涓婄殑<form>鏍囩
document.forms.length //瀵瑰簲欏甸潰涓?lt;form>鏍囩鐨勪釜鏁?/font>
document.forms[0] //絎?涓?lt;form>鏍囩
document.forms[i] //絎琲-1涓?lt;form>鏍囩
document.forms[i].length //絎琲-1涓?lt;form>涓殑鎺т歡鏁?/font>
document.forms[i].elements[j] //絎琲-1涓?lt;form>涓j-1涓帶浠?/font>
b)閫氳繃鏍囩name灞炴х洿鎺ュ紩鐢?/font>
<form name="Myform"><input name="myctrl"></form>
document.Myform.myctrl //document.琛ㄥ崟鍚?鎺т歡鍚?br />
<html>
<!--Text鎺т歡鐩稿叧Script-->
<form name="Myform">
<input type="text" name="oText">
<input type="password" name="oPswd">
<form>
<script language="javascript">
//鑾峰彇鏂囨湰瀵嗙爜妗嗙殑鍊?/p>
document.write(document.Myform.oText.value)
document.write(document.Myform.oPswd.value)
</script>
</html>
------------------------------------------------------------------------------------------------------------
<html>
<!--Select鎺т歡鐩稿叧Script-->
<form name="Myform">
<select name="oSelect">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</form>
<script language="javascript">
</script> <script language="javascript"> </script> <script language="javascript"> </script> <script language="javascript"> </script> <html> ----------------------------------------------------------------------------------------------------------- <Div id="oDiv">Text</Div> document.all.oDiv document.all.oDiv.style document.all.oDiv.style.display="" document.all.oDiv.style.display="none"
if (window.XMLHttpRequest) {
//瀵逛簬Mozilla錒慛etscape錒慡afari絳夋祻瑙堝櫒錛屽垱寤篨MLHttpRequest
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
//濡傛灉鏈嶅姟鍣ㄥ搷搴旂殑header涓嶆槸text/xml錛屽彲浠ヨ皟鐢ㄥ叾瀹冩柟娉曚慨鏀硅header
http_request.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) {
// 瀵逛簬Internet Explorer嫻忚鍣紝鍒涘緩XMLHttpRequest
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
return http_request;
}
//鑾峰緱Url 鐨剅esponseText
function getResponseText(url)
{
http_request=getRequest();
http_request.open('GET', url, false);
http_request.send(null);
if (http_request.readyState == 4)
銆銆 {
銆銆銆// 鏀跺埌瀹屾暣鐨勬湇鍔″櫒鍝嶅簲
銆銆銆if (http_request.status == 200) {
銆銆銆銆 //HTTP鏈嶅姟鍣ㄥ搷搴旂殑鍊糘K
銆銆銆銆 requestdoc = http_request.responseText;
銆銆銆銆 //灝嗘湇鍔″櫒榪斿洖鐨勫瓧絎︿覆鍐欏埌欏甸潰涓璉D涓簃essage鐨勫尯鍩?br />
}
銆銆銆 else {
銆銆銆銆 requestdoc = http_request.status;
銆銆銆 }
銆銆 }
return requestdoc;
}
//鑾峰緱Url 鐨剅esponseXML
function getResponseText(url)
{
http_request=getRequest();
http_request.open('GET', url, false);
http_request.send(null);
if (http_request.readyState == 4)
銆銆 {
銆銆銆// 鏀跺埌瀹屾暣鐨勬湇鍔″櫒鍝嶅簲
銆銆銆if (http_request.status == 200) {
銆銆銆銆 //HTTP鏈嶅姟鍣ㄥ搷搴旂殑鍊糘K
銆銆銆銆 requestdoc = http_request.responseXML;
銆銆銆銆 //灝嗘湇鍔″櫒榪斿洖鐨勫瓧絎︿覆鍐欏埌欏甸潰涓璉D涓簃essage鐨勫尯鍩?br />
}
銆銆銆 else {
銆銆銆銆 requestdoc = http_request.status;
銆銆銆 }
銆銆 }
return requestdoc;
}