Вы находитесь на странице: 1из 3

document �ĵ����� - javascript�ű���������

����������������������������������������������
‫ע‬:ҳ���� ��name���Ժ�Javascript���õ���Ʊ���һ�°�(��Сд

�������ʾ��һ�������Ϣ �����õ� ��Ϊ�


�� ջ ��Ƕ���\\\\\��
����������������������������������������������

��������
document.title //�����ĵ����� ���Html��title��ǩ
document.bgcolor //����ҳ�汳��ɫ
document.fgcolor //����ǰ��ɫ(�ı���ɫ)
document.linkcolor //δ�����t����ɫ
document.alinkcolor //����t��(�����‫�ڴ‬t����)����ɫ
document.vlinkcolor //�ѵ����t����ɫ
document.url //����url���Դ ��� һ��� ‫���ڴ‬һ��ҳ

document.filecreateddate //�ļ���b���‫������ֻ�ڣ‬

document.filemodifieddate //�ļ��‫������ֻ� ����ڣ‬

document.filesize //�ļ���С��ֻ������
document.cookie //���ú s�cookie
document.charset //�����ַ� ��������:gb2312
����������������������������������������������
���ö�� �
document.write() //��̬��ҳ��д������
document.createelement(tag) //����һ��html��ǩ����
document.getelementbyid(id) //���ָ��idֵ�Ķ���

document.getelementsbyname(name) //���ָ��nameֵ�Ķ���
document.body.appendchild(otag)
����������������������������������������������

body-����� ���
document.body //ָ���ĵ�����Ŀ�ʼ� ��� ���body>/body>
document.body.bgcolor //���û�� �������ı�����ɫ
document.body.link //δ�����t����ɫ
document.body.alink //����t��(�����‫�ڴ‬t����)����ɫ
document.body.vlink //�ѵ����t����ɫ
document.body.text //�ı�ɫ
document.body.innertext //����body>��/body>֮����ı�

document.body.innerhtml //����body>��/body>֮���html����

document.body.topmargin //ҳ���ϱ �

document.body.leftmargin //ҳ���� �

document.body.rightmargin //ҳ���ұ �

document.body.bottommargin //ҳ���± �
document.body.background //���� Ƭ

document.body.appendchild(otag) //��̬���һ��HTMl����
���ö����¼�
document.body.onclick=��func()�� //���ָ�뵥������Ǵ���

document.body.onmouseover=��func()�� //���ָ���Ƶ�����ʱ����

document.body.onmouseout=��func()�� //���ָ���Ƴ����ʱ����
����������������������������������������������
location-λ���Ӷ���

document.location.hash // #�ź�IJ���
document.location.host // ����+� ‫�ں‬
document.location.hostname // ����
document.location.href // ����url
document.location.pathname // Ŀ¼����
document.location.port // � ‫�ں‬
document.location.protocol // ������(http:)
document.location.search // ?�ź�IJ���

documeny.location.reload() //ˢ����ҳ
document.location.reload(url) //���µ���ҳ
document.location.assign(url) //���µ���ҳ
document.location.replace(url) //���µ���ҳ
����������������������������������������������
selection-ѡ���Ӷ���
document.selection
����������������������������������������������

images����(ҳ���е� ��)

a)ͨ�������
document.images //��Ӧҳ��� �img��ǩ
document.images.length //��Ӧҳ����img��ǩ�ĸ���
document.images[0] //��1��img��ǩ
document.images[i] //��i-1��img��ǩ

b)ͨ��nane����ֱ������
img name=��oimage��
document.images.oimage //document.images.name����

c)���� Ƭ��src����
document.images.oimage.src //document.images.name����.src

d)����һ�� ��
var oimage
oimage = new image()
document.images.oimage.src=��1.jpg��
ʱ��ҳ��� �bһ��img /��ǩ��֮��Ӧ� �����ʾ

����������������������������������������������-

forms����(ҳ���еı)

a)ͨ�������
document.forms //��Ӧҳ��� �form��ǩ
document.forms.length //��Ӧҳ����/formform��ǩ�ĸ���
document.forms[0] //��1��/formform��ǩ
document.forms[i] //��i-1��/formform��ǩ
document.forms[i].length //��i-1��/formform�еĿ ���

document.forms[i].elements[j] //��i-1��/formform�е�j-1�� �

b)ͨ���ǩname����ֱ������
/formform name=��myform��>input name=��myctrl��/>/form
document.myform.myctrl //document.���.� ���

c)���ʱ������
document.forms[i].name //��Ӧform name>����
document.forms[i].action //��Ӧ/formform action>����
document.forms[i].encoding //��Ӧ/formform enctype>����
document.forms[i].target //��Ӧ/formform target>����

document.forms[i].appendchild(otag) //��̬����һ�� �
document.all.odiv //���� ��oDiv
document.all.odiv.style.display=��" // ����������
document.all.odiv.style.display=��none�� // ���������
document.getelementid(��odiv��) //ͨ��getElementid���ö���
document.getelementid(��odiv��).style=��"
document.getelementid(��odiv��).display=��none��
/*document.all��ʾdocument�����ж���ļ���
ֻ��ie֧�ִ���� ����Ҳ��4�ж�����������*/

������4������
document.getelementbyid(��id��).innertext //��̬����ı�
document.getelementbyid(��id��).innerhtml //��̬���HTMl
document.getelementbyid(��id��).outertext // innertext
document.getelementbyid(��id��).outerhtml // innerhtml

Вам также может понравиться