JS 样式获取 window.getComputedStyle

使用getComputedStyle获取元素样式的时候,一定要将样式的名称写完整 #test { border:solid 1px #ddd; } <div style="width:200px;height:200px;background:orange" id="test"></div> <script type="text/javascri...

Read more

JS onsubmit onreset事件

<!-- onsubmit事件的事件源是form标签 --> <form action="1.html" method="post"> 用户名:<input type="text" name="username"><br> 密码:<input type="text" name="password"><br&gt...

Read more

JS onselect事件

<textarea name="" id="info" cols="30" rows="10"></textarea> <script type="text/javascript"> // /获取元素 var info = document.getElementById('info'); info.onselect = f...

Read more

JS 城市联动

<select name="" id="province"> <option value="0">北京</option> <option value="1">河南</option> <option value="2">河北</option> ...

Read more

JS onchange事件

<select name="" id="yinliao"> <option value="0">白开水</option> <option value="1">矿泉水</option> <option value="2">白酒</option> <option value...

Read more

JS 焦点事件

input{ width:200px; height:20px; border:solid 1px #ddd; } <input type="text" /> <input type="text" /> <input type="text" /> <input type="text" id="username" /&...

Read more

JS 拖动div效果

<style> * { margin:0px; padding:0px; } #move { width:200px; height:200px; background:orange; position:absolute; } </style> <div id="move"></div...

Read more