JS 常用的方法
1. 信息提示框 alertalert('外面干啥呢??'); 2. 信息确认框 confirmvar res = confirm('你确定要离开么???'); 3. 获取用户的输入 prompt() 对话框alert('为了确保推算的准确性, 请您如实的填写信息!!!!'); var user = prompt('请输入您的名字!!'); var age = prompt('请输入您年纪...
1. 信息提示框 alertalert('外面干啥呢??'); 2. 信息确认框 confirmvar res = confirm('你确定要离开么???'); 3. 获取用户的输入 prompt() 对话框alert('为了确保推算的准确性, 请您如实的填写信息!!!!'); var user = prompt('请输入您的名字!!'); var age = prompt('请输入您年纪...
<body style="background:pink"></body> // f_1.html // f_2.html <body style="background:orange"> <script type="text/javascript"> //获取父级元素窗口的window对象 // parent 是用来存储父级窗口...
属性: 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> <b...
window.screen 对象包含有关用户屏幕的信息<div style="width:2000px;height:3000px;"></div>console.log(window.screen); 获取整个屏幕的宽度和高度var w = window.screen.width; var h = window.screen.height; 浏览器的可用宽度和高度var...
navigator需要在JS中获取客户端信息的时候 <?php echo '<pre>'; var_dump($_SERVER);die; //获取当前请求的userAgent $userAgent = $_SERVER['HTTP_USER_AGENT'];// lamp userAgent // var_dump(strpos($us...
使用getComputedStyle获取元素样式的时候,一定要将样式的名称写完整 #test { border:solid 1px #ddd; } <div style="width:200px;height:200px;background:orange" id="test"></div> <script type="text/javascript"&g...
<style> #one{ width:500px; height:500px; position:absolute; border-radius: 50%; background:pink; left:400px; } #two{ width:400px; height:400px; position:absol...
<!-- onsubmit事件的事件源是form标签 --> <form action="1.html" method="post"> 用户名:<input type="text" name="username"><br> 密码:<input type="text" name="password"><br> ...
<textarea name="" id="info" cols="30" rows="10"></textarea> <script type="text/javascript"> // /获取元素 var info = document.getElementById('info'); info.onselect = functio...
<select name="" id="province"> <option value="0">北京</option> <option value="1">河南</option> <option value="2">河北</option> ...