当前位置:Gxlcms > JavaScript > JavaScript学习笔记(十一)_基础知识

JavaScript学习笔记(十一)_基础知识

时间:2021-07-01 10:21:17 帮助过:6人阅读

document对象

下表列出了BOMdocument对象的一些通用属性:

alinkColor

激活的链接的颜色,如定义的*

bgColor

页面的背景颜色,如定义的*

fgColor

页面的文本颜色,如定义的*

lastModified

最后修改页面的日期,是字符串

linkColor

链接的颜色,如定义的*

referrer

浏览器历史中后退一个位置的URL

title

<FONT face=宋体>标签中显示的文本</FONT></P></TD></TR> <TR> <TD vAlign=top width=151> <P>URL</P></TD> <TD vAlign=top width=439> <P><FONT face=宋体>当前载入的页面的</FONT>URL</P></TD></TR> <TR> <TD vAlign=top width=151> <P>vlinkColor</P></TD> <TD vAlign=top width=439> <P><FONT face=宋体>访问过的链接的颜色,如</FONT><body vlink="color"><FONT face=宋体>定义的</FONT><SUP>*</SUP></P></TD></TR></TBODY></TABLE></DIV> <P>* <FONT face=宋体>反对使用这些属性,因为它们引用了</FONT><body/><FONT face=宋体>标签中的旧</FONT>HTML<FONT face=宋体>特性。应该用样式表脚本代替它们。</FONT></P> <P> </P> <P>document<FONT face=宋体>对象也有许多集合,提供对载入的页面各个部分的访问。下表列出了这些集合:</FONT></P> <P> </P> <DIV align=center> <TABLE cellSpacing=0 cellPadding=0 width=556 border=0> <TBODY> <TR> <TD vAlign=top width=180> <P><FONT face=宋体>集</FONT> <FONT face=宋体>合</FONT></P></TD> <TD vAlign=top width=376> <P><FONT face=宋体>说</FONT> <FONT face=宋体>明</FONT></P></TD></TR> <TR> <TD vAlign=top width=180> <P>anchors</P></TD> <TD vAlign=top width=376> <P><FONT face=宋体>页面中所有锚的集合</FONT></P></TD></TR> <TR> <TD vAlign=top width=180> <P>applets</P></TD> <TD vAlign=top width=376> <P><FONT face=宋体>页面中所有</FONT>applet<FONT face=宋体>的集合</FONT></P></TD></TR> <TR> <TD vAlign=top width=180> <P>embeds</P></TD> <TD vAlign=top width=376> <P><FONT face=宋体>页面中所有嵌入式对象的集合(由</FONT><embed/><FONT face=宋体>标签表示)</FONT></P></TD></TR> <TR> <TD vAlign=top width=180> <P>forms</P></TD> <TD vAlign=top width=376> <P><FONT face=宋体>页面中所有表单的集合</FONT></P></TD></TR> <TR> <TD vAlign=top width=180> <P>images</P></TD> <TD vAlign=top width=376> <P><FONT face=宋体>页面中所有图像的集合</FONT></P></TD></TR> <TR> <TD vAlign=top width=180> <P>links</P></TD> <TD vAlign=top width=376> <P><FONT face=宋体>页面中所有链接的集合</FONT></P></TD></TR></TBODY></TABLE></DIV> <P><FONT face=宋体>与</FONT>window.frame<FONT face=宋体>集合相似,可用数字或名字引用</FONT>document<FONT face=宋体>对象的每个集合,也就是说可用</FONT>document.images[0]<FONT face=宋体>或</FONT>document.images["<FONT face=宋体>图片的</FONT>name"]<FONT face=宋体>访问图像。</FONT></P> <P><FONT face=宋体></FONT> </P> <H1>location对象</H1> <P><FONT face=宋体>location对象表示载入窗口的URL,此外它还可以解析URL。</FONT></P> <P><FONT face=宋体><STRONG>hash</STRONG>——如果URL包含#,该方法将返回该符号之后的内容(例如,http://www.somewhere.com/index#selection1的hash等于"#selection1")。</FONT></P> <P><FONT face=宋体><STRONG>host</STRONG>——服务器的名字(如www.wrox.com)。</FONT></P> <P><FONT face=宋体><STRONG>hostname</STRONG>——通常等于host,有时会省略前面的www。</FONT></P> <P><FONT face=宋体><STRONG>href</STRONG>——当前载入的页面的完整URL。</FONT></P> <P><FONT face=宋体><STRONG>pathname</STRONG>——URL中<STRONG>主机名后的部分</STRONG>。例如,http://www.somewhere.com/pictures/index.htm的pathname是"/pictures/index.htm"。</FONT></P> <P><FONT face=宋体><STRONG>port</STRONG>——URL中声明的请求的端口。默认情况下,大多数URL没有端口信息,所以该属性通常是空白的。像http://www.somewhere.com:8080/index.htm这样的URL的port属性等于8080。</FONT></P> <P><FONT face=宋体><STRONG>protocol</STRONG>——URL中使用的协议,即双斜杠(//)之前的部分。例如,http://www.somewhere.com中的protocol属性等于http:,ftp://www.somewhere.com的protocol属性等于ftp:。</FONT></P> <P><FONT face=宋体><STRONG>search</STRONG>——执行GET请求的URL中的问号(?)后的部分,又称为查询字符串。例如,http://www.somewhere.com/abc.htm?term=javascript中的search属性等于?term=javascript</FONT></P> <P><FONT face=宋体></FONT> </P> <P><FONT face=宋体>跳转到一个页面,但是不想从浏览器历史中访问,即不能后退回来,可以使用方法<STRONG>location.replace</STRONG>(</FONT>"http://www.baidu.com"<FONT face=宋体>)方法。</FONT></P> <P><FONT face=宋体></FONT> </P> <H1>navigator对象</H1> <P><FONT face=宋体>检测<STRONG>浏览器</STRONG>的版本、所支持的MIME类型、已安装的外挂程序(plug-in)。该对象包含两个子对象:外挂对象、MIME类型对象。</FONT></P> <TABLE cellSpacing=1 cellPadding=0 width=450 border=1> <TBODY> <TR> <TD width=160> <P align=center><STRONG><FONT face=宋体>appCodeName</FONT></STRONG></P></TD> <TD> <P><FONT face=宋体>代码</FONT></P></TD></TR> <TR> <TD> <P align=center><STRONG><FONT face=宋体>appName</FONT></STRONG></P></TD> <TD> <P><FONT face=宋体>名称</FONT></P></TD></TR> <TR> <TD> <P align=center><STRONG><FONT face=宋体>appVersion</FONT></STRONG></P></TD> <TD> <P><FONT face=宋体>版本</FONT></P></TD></TR> <TR> <TD> <P align=center><STRONG><FONT face=宋体>language</FONT></STRONG></P></TD> <TD> <P><FONT face=宋体>语言</FONT></P></TD></TR> <TR> <TD> <P align=center><STRONG><FONT face=宋体>mimeType</FONT></STRONG></P></TD> <TD> <P><FONT face=宋体>以数组表示所支持的MIME类型</FONT></P></TD></TR> <TR> <TD> <P align=center><STRONG><FONT face=宋体>platform</FONT></STRONG></P></TD> <TD> <P><FONT face=宋体>编译浏览器的机器类型</FONT></P></TD></TR> <TR> <TD> <P align=center><STRONG><FONT face=宋体>plugins</FONT></STRONG></P></TD> <TD> <P><FONT face=宋体>以数组表示已安装的外挂程序</FONT></P></TD></TR> <TR> <TD> <P align=center><STRONG><FONT face=宋体>userAgent</FONT></STRONG></P></TD> <TD> <P><FONT face=宋体>用户代理程序的表头</FONT></P></TD></TR></TBODY></TABLE> <P><FONT face=宋体></FONT> </P> <H1>screen对象</H1> <P><FONT face=宋体>screen对象包含了<STRONG>屏幕</STRONG>信息,通常包含下列属性(不过,许多浏览器都加入了自己的属性):</FONT></P> <P><FONT face=宋体><STRONG>height</STRONG>——屏幕的高度,以像素计。</FONT></P> <P><FONT face=宋体><STRONG>width</STRONG>——屏幕的宽度,以像素计。</FONT></P> <P><FONT face=宋体><STRONG>availHeight</STRONG>——窗口可以使用的屏幕的高度(以像素计),减去了任务栏的宽,随用户任务栏而变,不会随窗口而改变,其中包括操作系统元素(如Windows工具栏)需要的空间。</FONT></P> <P><FONT face=宋体><STRONG>availWidth</STRONG>——窗口可以使用的屏幕的宽度(以像素计),减去了任务栏的高,随用户任务栏而变。</FONT></P> <P><FONT face=宋体><STRONG>colorDepth</STRONG>——用户屏幕的颜色深度,以每像素的位数计。实际上就是表示颜色的位数。大多数系统采用32位。</FONT></P> <P><FONT face=宋体></FONT> </P> <P><FONT face=宋体>确定新窗口的大小时,availHeight和availWidth属性非常有用。例如,可以使用下面的代码填充用户的屏幕:</FONT></P> <P><FONT face=宋体>moveTo(0,0);</FONT></P> <P><FONT face=宋体>resizeTo(screen.availWidth,screen,availHeight);</FONT> </div> <div class=""> <ul class="m-news-opt fix"> <li class="opt-item"> <a href='/JavaScript-230379.html' target='_blank'><p>< 上一篇</p><p class="ellipsis">屏蔽Flash右键信息的js代码_javascript技巧</p></a> </li> <li class="opt-item ta-r"> <a href='/JavaScript-230381.html' target='_blank'><p>下一篇 ></p><p class="ellipsis">javascript不间断的图片滚动并可点击_图象特效</p></a> </li> </ul> </div> </div> </div> <div class="g-title fix"> <h2 class="title-txt">人气教程排行</h2> </div> <div class="m-rank u-dashed mb40"> <ul> <li class="rank-item"> <a href="/JavaScript-60002.html" title='vue2 设置router-view默认路径的实例' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">213次</span> <span class="g-sort-num top">1</span> vue2 设置router-view默认路径的实例 </a> </li> <li class="rank-item"> <a href="/JavaScript-56926.html" title='Vue-路由导航菜单栏的高亮设置方法' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">213次</span> <span class="g-sort-num second">2</span> Vue-路由导航菜单栏的高亮设置方法 </a> </li> <li class="rank-item"> <a href="/JavaScript-56852.html" title='基于Axios 常用的请求方法别名(详解)' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">213次</span> <span class="g-sort-num third">3</span> 基于Axios 常用的请求方法别名(详解) </a> </li> <li class="rank-item"> <a href="/JavaScript-39788.html" title='JavaScript+canvas实现七色板效果实例' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">213次</span> <span class="g-sort-num ">4</span> JavaScript+canvas实现七色板效果实例 </a> </li> <li class="rank-item"> <a href="/JavaScript-281548.html" title='实现vuex的初始化方法' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">212次</span> <span class="g-sort-num ">5</span> 实现vuex的初始化方法 </a> </li> <li class="rank-item"> <a href="/JavaScript-238997.html" title='jQuery:当鼠标快速移动时无法触发mouseleave事件的问题解决' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">212次</span> <span class="g-sort-num ">6</span> jQuery:当鼠标快速移动时无法触发mouseleave事件的问题解决 </a> </li> <li class="rank-item"> <a href="/JavaScript-234597.html" title='Array.slice()与Array.splice()的返回值类型_基础知识' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">212次</span> <span class="g-sort-num ">7</span> Array.slice()与Array.splice()的返回值类型_基础知识 </a> </li> <li class="rank-item"> <a href="/JavaScript-60647.html" title='微信小程序使用swiper组件实现层叠轮播图' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">212次</span> <span class="g-sort-num ">8</span> 微信小程序使用swiper组件实现层叠轮播图 </a> </li> <li class="rank-item"> <a href="/JavaScript-57684.html" title='element-ui 限制日期选择的方法(datepicker)' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">212次</span> <span class="g-sort-num ">9</span> element-ui 限制日期选择的方法(datepicker) </a> </li> <li class="rank-item"> <a href="/JavaScript-57417.html" title='vue-baidu-map 进入页面自动定位的解决方案(推荐)' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">212次</span> <span class="g-sort-num ">10</span> vue-baidu-map 进入页面自动定位的解决方案(推荐) </a> </li> <li class="rank-item"> <a href="/JavaScript-54331.html" title='JS实现元素上下左右移动效果' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">212次</span> <span class="g-sort-num ">11</span> JS实现元素上下左右移动效果 </a> </li> <li class="rank-item"> <a href="/JavaScript-32878.html" title='node.js中的emitter.on方法使用说明' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">212次</span> <span class="g-sort-num ">12</span> node.js中的emitter.on方法使用说明 </a> </li> <li class="rank-item"> <a href="/JavaScript-251986.html" title='在js中如何实现图片左右滑动' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">211次</span> <span class="g-sort-num ">13</span> 在js中如何实现图片左右滑动 </a> </li> <li class="rank-item"> <a href="/JavaScript-65218.html" title='layui button 按钮弹出提示窗口,确定才进行的方法' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">211次</span> <span class="g-sort-num ">14</span> layui button 按钮弹出提示窗口,确定才进行的方法 </a> </li> <li class="rank-item"> <a href="/JavaScript-53968.html" title='深入理解Vue生命周期、手动挂载及挂载子组件' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">211次</span> <span class="g-sort-num ">15</span> 深入理解Vue生命周期、手动挂载及挂载子组件 </a> </li> <li class="rank-item"> <a href="/JavaScript-32108.html" title='JS 使用for循环遍历子节点查找元素' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">211次</span> <span class="g-sort-num ">16</span> JS 使用for循环遍历子节点查找元素 </a> </li> <li class="rank-item"> <a href="/JavaScript-286609.html" title='bootstrap如何设置表单必填' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">210次</span> <span class="g-sort-num ">17</span> bootstrap如何设置表单必填 </a> </li> <li class="rank-item"> <a href="/JavaScript-286358.html" title='bootstrap4兼容哪些浏览器' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">210次</span> <span class="g-sort-num ">18</span> bootstrap4兼容哪些浏览器 </a> </li> <li class="rank-item"> <a href="/JavaScript-247980.html" title='jQuery实现追加数组并去重功能' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">210次</span> <span class="g-sort-num ">19</span> jQuery实现追加数组并去重功能 </a> </li> <li class="rank-item"> <a href="/JavaScript-215560.html" title='jQuery实现的在线答题功能_jquery' class="item-name ellipsis" target="_blank"> <span class="g-art-count fr">210次</span> <span class="g-sort-num ">20</span> jQuery实现的在线答题功能_jquery </a> </li> </ul> </div> </div> </div> <!-- / 教程内容页 --> </div> </div> <!-- 页尾 --> <div class="footer"> 本站所有资源全部来源于网络,若本站发布的内容侵害到您的隐私或者利益,请联系我们删除!</div> <!-- / 页尾 --> <script type="text/javascript" src="/kan/js/read.js"></script> <div style="display:none"> <div class="login-box" id="login-dialog"> <div class="login-top"><a class="current" rel="nofollow" id="login1" onclick="setTab('login',1,2);" >登录</a></div> <div class="login-form" id="nav-signin"> <!-- <div class="login-ico"><a rel="nofollow" class="qq" id="qqlogin" target="_blank" href="/user-center-qqlogin.html"> QQ </a></div> --> <div class="login-box-form" id="con_login_1"> <form id="loginform" action="/user-center-login.html" method="post" onsubmit="return false;"> <p class="int-text"> <input class="email" id="username" name="username" type="text" value="用户名或Email" onfocus="if(this.value=='用户名或Email'){this.value='';}" onblur="if(this.value==''){this.value='用户名或Email';};" ></p> <p class="int-text"> <input class="password1" type="password" id="password" name="password" value="******" onBlur="if(this.value=='') this.value='******';" onFocus="if(this.value=='******') this.value='';" > </p> <p class="int-info"> <label class="ui-label"> </label> <label for="agreement" class="ui-label-checkbox"> <input type="checkbox" value="" name="cookietime" id="cookietime" checked="checked" value="2592000"> <input type="hidden" name="notforward" id="notforward" value="1"> <input type="hidden" name="dosubmit" id="dosubmit" value="1">记住我的登录 </label> <a rel="nofollow" class="aright" href="/user-center-forgetpwd.html" target="_blank"> 忘记密码? </a></p> <p class="int-btn"><a rel="nofollow" id="loginbt" class="loginbtn"><span>登录</span></a></p> </form> </div> <form id="regform" action="/user-center-reg.html" method="post"> <div class="login-reg" style="display: none;" id="con_login_2"> <input type="hidden" name="t" id="t"/> <p class="int-text"> <input id="email" name="email" type="text" value="Email" onfocus="if(this.value=='Email'){this.value='';}" onblur="if(this.value==''){this.value='Email';};"></p> <p class="int-text"> <input id="uname" name="username" type="text" value="用户名或昵称" onfocus="if(this.value=='用户名或昵称'){this.value='';}" onblur="if(this.value==''){this.value='用户名或昵称';};"></p> <p class="int-text"> <input type="password" id="pwd" name="password" value="******" onBlur="if(this.value=='') this.value='******';" onFocus="if(this.value=='******') this.value='';"> </p> <p class="int-text1"><span class="inputbox"> <input id="validate" name="validate" type="text" value="验证码" onfocus="if(this.value=='验证码'){this.value='';}" onblur="if(this.value==''){this.value='验证码';};"> </span><span class="yzm-img"><img src="/user-checkcode-index" alt="看不清楚换一张" id="indexlogin"></p> <p class="int-info"> <label> <input value="" name="agreement" id="agreement" CHECKED="checked" type="checkbox"> 我已阅读<a rel="nofollow" href="/user-center-agreement.html">用户协议</a>及<a rel="nofollow" href="/user-center-agreement.html">版权声明</a></label> </p> <p class="int-btn"><input type="hidden" name="dosubmit"/> <a rel="nofollow" class="loginbtn" id="register"><span>注册</span></a></p> </div> </form> </div> </div> </div> </div> <script type="text/javascript" src="/kan/js/foot_js.js"></script> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?6dc1c3c5281cf70f49bc0bc860ec24f2"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> <script type="text/javascript" src="/layui/layui.js"></script> <script> layui.use('code', function() { layui.code({ elem: 'pre', //默认值为.layui-code about: false, skin: 'notepad', title: 'php怎么实现数据库验证跳转代码块', encode: true //是否转义html标签。默认不开启 }); }); </script> </body> </html>