JS form元素的获取

特殊的属性elements 属于form标签元素var form = document.forms[0]; //elements fs = form.elements;//这个属性只包括了 form元素 修改背景fs[0].style.background = 'red'; name属性来获取var text = form.intro; text.style.background...

Read more

JS 获取元素

获取元素<style type="text/css"> *{ /*padding:0px; margin:0px;*/ list-style:none; text-decoration:none; font-family:microsoft yahei; } #all{ padding:10px; width:...

Read more

JS 节点集合

<form action=""> </form> <form action=""> </form> <form action=""> </form> <a href="">百度</a> <a href="">天猫</a> <a href="">京东&lt...

Read more

JS form元素值的操作

<input type="text" name="username" value="this is a test"><br> 性别: <input type="radio" name="sex" value="1" checked>男 <input type="radio" name="sex" value="0" >女<br&gt...

Read more

JS 节点相关操作

<style> #content { width:800px; height:500px; border:solid 1px #ddd; margin: 0 auto; } .item { width:100px; height...

Read more

JS 抽奖

<style> #abc { width:300px; height:200px; margin: 0 auto; border:solid 1px #ddd; text-align:center; font-size:30px; line-heigh...

Read more

JS scrollTo scrollBy

scrollTo scrollBy#c { width:100px; height:50px; background:#eaf; position:fixed; right:0px; top:100px; } <div style="width:200px;margin:0 auto;height:auto;background...

Read more

JS 常用的方法

1. 信息提示框 alertalert('外面干啥呢??'); 2. 信息确认框 confirmvar res = confirm('你确定要离开么???'); 3. 获取用户的输入 prompt() 对话框alert('为了确保推算的准确性, 请您如实的填写信息!!!!'); var user = prompt('请输入您的名字!!'); var age = prompt('请输...

Read more

JS BOM frames子对象

<body style="background:pink"></body> // f_1.html // f_2.html <body style="background:orange"> <script type="text/javascript"> //获取父级元素窗口的window对象 // parent 是用来...

Read more

JS BOM history子对象

属性: length方法: back() forward() go(1) <a href="h_1.html">h_1</a> <a href="h_2.html">h_2</a> <a href="h_3.html">h_3</a> <button id="f">前进</button> ...

Read more