📄 document 对象的常用方法.mht
字号:
=
//=C9=E8=D6=C3=BB=F2=BB=F1=C8=A1=B6=D4=CF=F3=BA=F3=C3=E6=B5=C4=B1=B3=BE=B0=
=D1=D5=C9=AB<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.body.link &=
nbsp; =20
=
//=CE=B4=B5=E3=BB=F7=B9=FD=B5=C4=C1=B4=BD=D3=D1=D5=C9=AB<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.body.alink =
=20
=
//=BC=A4=BB=EE=C1=B4=BD=D3(=BD=B9=B5=E3=D4=DA=B4=CB=C1=B4=BD=D3=C9=CF)=B5=
=C4=D1=D5=C9=AB<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.body.vlink =
=20
=
//=D2=D1=B5=E3=BB=F7=B9=FD=B5=C4=C1=B4=BD=D3=D1=D5=C9=AB<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.body.text &=
nbsp; =20
//=CE=C4=B1=BE=C9=AB<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.body.innerText =20
=
//=C9=E8=D6=C3<body>...</body>=D6=AE=BC=E4=B5=C4=CE=C4=B1=BE<=
BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.body.innerHTML =20
=
//=C9=E8=D6=C3<body>...</body>=D6=AE=BC=E4=B5=C4HTML=B4=FA=C2=
=EB<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.body.topMargin =20
//=D2=B3=C3=E6=C9=CF=B1=DF=BE=E0<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.body.leftMargin =20
//=D2=B3=C3=E6=D7=F3=B1=DF=BE=E0<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.body.rightMargin =20
//=D2=B3=C3=E6=D3=D2=B1=DF=BE=E0<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.body.bottomMargin =20
//=D2=B3=C3=E6=CF=C2=B1=DF=BE=E0<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.body.background =20
//=B1=B3=BE=B0=CD=BC=C6=AC</P>
<P><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.body.appendChild(oTag)=20
//=B6=AF=CC=AC=C9=FA=B3=C9=D2=BB=B8=F6HTML=B6=D4=CF=F3</P>
<P>=B3=A3=D3=C3=B6=D4=CF=F3=CA=C2=BC=FE<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.body.onclick=3D"func()"  =
; =20
=
//=CA=F3=B1=EA=D6=B8=D5=EB=B5=A5=BB=F7=B6=D4=CF=F3=CA=C7=B4=A5=B7=A2<BR><=
STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.body.onmouseover=3D"func()" &=
nbsp; =20
=
//=CA=F3=B1=EA=D6=B8=D5=EB=D2=C6=B5=BD=B6=D4=CF=F3=CA=B1=B4=A5=B7=A2<BR><=
STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.body.onmouseout=3D"func()" &n=
bsp; =20
=
//=CA=F3=B1=EA=D6=B8=D5=EB=D2=C6=B3=F6=B6=D4=CF=F3=CA=B1=B4=A5=B7=A2=20
=
<BR>---------------------------------------------------------------------=
<BR>location-=CE=BB=D6=C3=D7=D3=B6=D4=CF=F3</P>
<P><FONT size=3D2><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.location.hash</FONT> &n=
bsp; =20
// #=BA=C5=BA=F3=B5=C4=B2=BF=B7=D6<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.location.host &nb=
sp;=20
// =D3=F2=C3=FB+=B6=CB=BF=DA=BA=C5<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.location.hostname =20
// =D3=F2=C3=FB<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.location.href &nb=
sp;=20
// =CD=EA=D5=FBURL<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.location.pathname =20
// =C4=BF=C2=BC=B2=BF=B7=D6<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.location.port &nb=
sp;=20
// =B6=CB=BF=DA=BA=C5<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.location.protocol =20
// =CD=F8=C2=E7=D0=AD=D2=E9(http:)<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.location.search =20
// ?=BA=C5=BA=F3=B5=C4=B2=BF=B7=D6</P>
<P>documeny.location.reload() =20
//=CB=A2=D0=C2=CD=F8=D2=B3<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.location.reload(URL) =20
//=B4=F2=BF=AA=D0=C2=B5=C4=CD=F8=D2=B3<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.location.assign(URL) =20
//=B4=F2=BF=AA=D0=C2=B5=C4=CD=F8=D2=B3<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.location.replace(URL) =20
=
//=B4=F2=BF=AA=D0=C2=B5=C4=CD=F8=D2=B3<BR>-------------------------------=
--------------------------------------<BR>selection-=D1=A1=C7=F8=D7=D3=B6=
=D4=CF=F3<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.selection<BR>---------------------------------=
------------------------------------</P>
<P>images=BC=AF=BA=CF(=D2=B3=C3=E6=D6=D0=B5=C4=CD=BC=CF=F3)</P>
<P>a)=CD=A8=B9=FD=BC=AF=BA=CF=D2=FD=D3=C3<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.images &nbs=
p; =20
=
//=B6=D4=D3=A6=D2=B3=C3=E6=C9=CF=B5=C4<img>=B1=EA=C7=A9<BR><STRONG =
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.images.length &nb=
sp;=20
=
//=B6=D4=D3=A6=D2=B3=C3=E6=C9=CF<img>=B1=EA=C7=A9=B5=C4=B8=F6=CA=FD=
<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.images[0] &=
nbsp; =20
=
//=B5=DA1=B8=F6<img>=B1=EA=C7=A9  =
; <BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.images[i] &=
nbsp; =20
//=B5=DAi-1=B8=F6<img>=B1=EA=C7=A9</P>
<P>b)=CD=A8=B9=FDnane<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#99ff99">=CA=F4=D0=D4</STRONG>=D6=B1=BD=D3=D2=FD=D3=C3<BR><img=20
name=3D"oImage"><BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.images.oImage &nb=
sp;=20
//<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.images.name<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#99ff99">=CA=F4=D0=D4</STRONG></P>
<P>c)=D2=FD=D3=C3=CD=BC=C6=AC=B5=C4src<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#99ff99">=CA=F4=D0=D4</STRONG><BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.images.oImage.src =20
//<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.images.name<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#99ff99">=CA=F4=D0=D4</STRONG>.src</P>
<P>d)=B4=B4=BD=A8=D2=BB=B8=F6=CD=BC=CF=F3<BR>var oImage<BR>oImage =
=3D new Image()<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.images.oImage.src=3D"1.jpg"<BR>=CD=AC=CA=B1=D4=
=DA=D2=B3=C3=E6=C9=CF=BD=A8=C1=A2=D2=BB=B8=F6<img>=B1=EA=C7=A9=D3=EB=
=D6=AE=B6=D4=D3=A6=BE=CD=BF=C9=D2=D4=CF=D4=CA=BE</P>
<P><html><BR><img name=3DoImage><BR><script =
language=3D"<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#ffff66">javascript</STRONG>"><BR> =20
var oImage<BR> oImage =3D new=20
Image()<BR> <STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.images.oImage.src=3D"1.jpg"<BR></script>=
<BR></html></P>
<P><html><BR><script language=3D"<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#ffff66">javascript</STRONG>"><BR> =20
oImage=3D<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.caeateElement("IMG")<BR> =20
oImage.src=3D"1.jpg"<BR> <STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.body.appendChild(oImage)<BR></script><BR=
></html></P>
=
<P>----------------------------------------------------------------------=
</P>
<P>forms=BC=AF=BA=CF(=D2=B3=C3=E6=D6=D0=B5=C4=B1=ED=B5=A5)</P>
<P>a)=CD=A8=B9=FD=BC=AF=BA=CF=D2=FD=D3=C3<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.forms  =
; =20
=
//=B6=D4=D3=A6=D2=B3=C3=E6=C9=CF=B5=C4<form>=B1=EA=C7=A9<BR><STRONG=
=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.forms.length &nbs=
p; =20
=
//=B6=D4=D3=A6=D2=B3=C3=E6=C9=CF<form>=B1=EA=C7=A9=B5=C4=B8=F6=CA=FD=
<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.forms[0] &n=
bsp; =20
//=B5=DA1=B8=F6<form>=B1=EA=C7=A9<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.forms[i] &n=
bsp; =20
//=B5=DAi-1=B8=F6<form>=B1=EA=C7=A9<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.forms[i].length &=
nbsp; =20
=
//=B5=DAi-1=B8=F6<form>=D6=D0=B5=C4=BF=D8=BC=FE=CA=FD<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.forms[i].elements[j] =20
//=B5=DAi-1=B8=F6<form>=D6=D0=B5=DAj-1=B8=F6=BF=D8=BC=FE</P>
<P>b)=CD=A8=B9=FD=B1=EA=C7=A9name<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#99ff99">=CA=F4=D0=D4</STRONG>=D6=B1=BD=D3=D2=FD=D3=C3<BR><form=20
name=3D"Myform"><input =
name=3D"myctrl"></form><BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.Myform.myctrl &nb=
sp; =20
//<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.=B1=ED=B5=A5=C3=FB.=BF=D8=BC=FE=C3=FB</P>
<P>c)=B7=C3=CE=CA=B1=ED=B5=A5=B5=C4<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#99ff99">=CA=F4=D0=D4</STRONG><BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.forms[i].name &nb=
sp; =20
//=B6=D4=D3=A6<form name><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#99ff99">=CA=F4=D0=D4</STRONG><BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.forms[i].action &=
nbsp; =20
//=B6=D4=D3=A6<form action><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#99ff99">=CA=F4=D0=D4</STRONG><BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.forms[i].encoding  =
;=20
//=B6=D4=D3=A6<form enctype><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#99ff99">=CA=F4=D0=D4</STRONG><BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.forms[i].target &=
nbsp; =20
//=B6=D4=D3=A6<form target><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#99ff99">=CA=F4=D0=D4</STRONG></P>
<P><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.forms[i].appendChild(oTag)=20
=
//=B6=AF=CC=AC=B2=E5=C8=EB=D2=BB=B8=F6=BF=D8=BC=FE<BR>-------------------=
----------------------------------------------------<BR><html><BR>&=
lt;!--Text=BF=D8=BC=FE=CF=E0=B9=D8Script--><BR><form=20
name=3D"Myform"><BR><input type=3D"text" =
name=3D"oText"><BR><input=20
type=3D"password" name=3D"oPswd"><BR><form><BR><script =
language=3D"<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#ffff66">javascript</STRONG>"><BR>//=BB=F1=C8=A1=CE=C4=B1=BE=C3=DC=C2=EB=
=BF=F2=B5=C4=D6=B5<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.write(<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.Myform.oText.value)<BR><STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.write(<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.Myform.oPswd.value)<BR></script><BR><=
/html><BR>------------------------------------------------------------=
-----------<BR><html><BR><!--checkbox,radio=BF=D8=BC=FE=CF=E0=B9=
=D8script--><BR><form=20
name=3D"Myform"><BR><input type=3D"checkbox" name=3D"chk"=20
value=3D"1">1 <BR><input =
type=3D"checkbox"=20
name=3D"chk"=20
=
value=3D"2">2 <BR></form> &nbs=
p; <BR><script=20
language=3D"<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#ffff66">javascript</STRONG>"> <BR>functi=
on=20
fun(){ <BR> =20
=
//=B1=E9=C0=FAcheckbox=BF=D8=BC=FE=B5=C4=D6=B5=B2=A2=C5=D0=B6=CF=CA=C7=B7=
=F1=D1=A1=D6=D0 <BR> var=20
length <BR> =
length=3D<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.forms[0].chk.length &nb=
sp;<BR> =20
=
for(i=3D0;i<length;i++){ <BR> =
=20
v=3D<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.forms[0].chk[i].value &=
nbsp;<BR> =20
b=3D<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#a0ffff">document</STRONG>.forms[0].chk[i].checked  =
; <BR> =20
if(b) <BR> =20
=
alert(v=3Dv+"=B1=BB=D1=A1=D6=D0") <BR> =
=20
else <BR> =20
=
alert(v=3Dv+"=CE=B4=D1=A1=D6=D0") <BR> =
=20
} <BR> =20
=
} <BR></script>  =
; <BR><a=20
href=3D#=20
=
onclick=3D"fun()">ddd</a> &nb=
sp; &nbs=
p; <BR></html>=20
=
<BR>---------------------------------------------------------------------=
--<BR><html><BR><!--Select=BF=D8=BC=FE=CF=E0=B9=D8Script--><B=
R><form=20
name=3D"Myform"><BR><select =
name=3D"oSelect"><BR><option=20
value=3D"1">1</option><BR><option=20
value=3D"2">2</option><BR><option=20
=
value=3D"3">3</option><BR></select><BR></form></P>
<P><script language=3D"<STRONG=20
style=3D"COLOR: black; BACKGROUND-COLOR: =
#ffff66">javascript</STRONG>"><BR> =20
=
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -