纸绘武身(HCJ)
<!DOCTYPE?html>
<html>
<head>
????<meta?charset="utf-8"?/>
????<title>js</title>
????<!--?外部JS?-->
????<!--?<script?src="js/new_file.js"></script>?-->
????<!--?內部JS?-->
????<style>
????????p?{
????????????text-align:?center;
????????}
????????span?{
????????????color:?rgb(22,?241,?121);
????????}
????????div{
????????????border:?1px?solid?red;
????????}
????????#div0{
????????????width:?200px;
????????????height:?200px;
????????}
????????#div2{
????????????width:?100px;
????????????height:?100px;
????????}
????????#div3{
????????????width:?100px;
????????????height:?100px;
????????}
????????.divh2{
????????????color:?#962cec;
????????}
????</style>
????
</head>
<body>
????<!--?<img?id="star"?src="img/1.jpg"?width="100%">?-->
????<!--?<p>
????????<span?id="time">2</span>秒之后自動跳轉到首頁...
????</p>
????<input?id="openBtn"?type="button"?value="打開窗口">;
????<input?type="button"?id="btn"?value="獲取歷史記錄個數">
????<div?id="div1">div1</div>
????<div?class="cls1">div5</div>
????<input?type="text"?name="username">
????<a?>點我</a>
????<input?type="button"?id="btn_set"?value="設置屬性">
????<input?type="button"?id="btn_remove"?value="刪除屬性">
????<div?id="div0">
????????<div?id="div2">div2</div>
????????div\</div>
????????<a?href="javascript:void(0);"?id="del">刪除子節點</a>
????????<a?href="javascript:void(0);"?id="add">添加子節點</a>
????<div?id="divh">divh</div>
????<div?id="divh2">divh2</div>?-->
????<input?type="text"?id="blur">
????<select?id="change">
????????<option>選擇</option>
????????<option>石家莊</option>
????</select>
????<script?type="text/javascript">
????????//?regExp();
????????//?global();
????????//?bom();
????????//?bom1();
????????//?bom2();
????????//?dom();
????????//?dom1();
????????//?HTMLdom();
????????things();
//正則表達式對象??
????????function?regExp()?{
????????????var?reg?=?/^\w{6,9}$/;
????????????var?userName?=?"robin";
????????????var?flag?=?reg.test(userName);
????????????alert(flag);
????????}
????????function?global()?{
//編碼
????????????var?str?=?"羅賓";
????????????var?E?=?encodeURIComponent(str);
????????????var?D?=?decodeURIComponent(E);
????????????document.write(E?+?"<br?/>");
????????????document.write(D);
//轉數字
????????????var?str?=?"12sdc";
????????????var?num?=?parseInt(str);
????????????document.write(num);
//判斷NaN
????????????var?num1?=?NaN;
????????????document.write(isNaN(num1));
//解析
????????????var?str1?=?document.write("robin");
????????????eval(str1);
????????}
????????function?bom(){
//?history對象????????????
????????????var?btn=document.getElementById("btn");
????????????btn.οnclick=function(){
????????????????var?length=history.length;
????????????????alert(length);
????????????}
????????}
//輪播圖
????????function?bom1()?{
????????????var?num1?=?1;
????????????function?fun()?{
????????????????num1++;
????????????????if?(num1?>?3)?{
????????????????????num1?=?1;
????????????????}
????????????????var?getElementById?=?document.getElementById("star");
????????????????getElementById.src?=?"img/"?+?num1?+?".jpg";
????????????}
????????????setInterval(fun,?3000);
????????????//?confirm("確定返回true,反則");
????????????//?prompt("輸入框");
????????????//?setTimeout(fun,2000);單次定時
????????????//?reload();刷新
????????????//?history.back();forword();length();
????????????//?go();加載具體頁面?+-傳參?
????????????function?open()?{
????????????????document.getElementById("openBtn");
????????????}
????????}
//自動跳轉首頁
????????function?bom2()?{
????????????var?num?=?2;
????????????function?show()?{
????????????????num--;
????????????????if?(num?<=?0)?{
????????????????????location.href?=?"https://i.qq.com";
????????????????}
????????????????//?var?time=document.getElementById("time");
????????????????document.getElementById("time").innerHTML?=?num?+?"";//導入到body
????????????}
????????????setInterval(show,?1000);
????????}
????????function?dom()?{
//?獲取element對象,返回數組
????????????var?divs?=?document.getElementsByTagName("div");
????????????var?div_cls?=?document.getElementsByClassName("cls1");
????????????var?ele_username?=?document.getElementsByName("username");
????????????console.log(divs);
????????????console.log(div_cls);
????????????console.log(ele_username);
//?創建dom對象
????????????//?設置屬性
????????????var?table?=?document.createElement("table");
????????????console.log(table);
//?Element對象
????????????var?btn_set?=?document.getElementById("btn_set");
????????????btn_set.onclick?=?function?()?{
????????????????var?element_a?=?document.getElementsByTagName("a")[0];
????????????????element_a.setAttribute("href",?"form.html")
????????????????//?刪除屬性
????????????????var?btn_remove?=?document.getElementById("btn_remove");
????????????????btn_remove.onclick?=?function?()?{
????????????????????var?element_a?=?document.getElementsByTagName("a")[0];
????????????????????element_a.removeAttribute("href")
????????????????}
????????????}
//?Node對象???????????????????
????????????var?del=document.getElementById("del");
????????????del.οnclick=function(){
????????????????var?div0=document.getElementById("div0");
????????????????var?div2=document.getElementById("div2");
????????????????div0.removeChild(div2);
????????????}
????????????var?add=document.getElementById("add");
????????????add.οnclick=function(){
????????????????var?div0=document.getElementById("div0");
????????????????var?div2=document.createElement("div");
????????????????div2.setAttribute("id","div2");
????????????????div0.appendChild(div2);
????????????}
}
//?點切???????????
????????????function?dom1()?{
????????????????var?star?=?document.getElementById("star");
????????????????var?flag?=?false;
????????????????star.onclick?=?function?()?{
????????????????????if?(flag)?{
????????????????????????star.src?=?"img/1.jpg";
????????????????????????flag?=?false;
????????????????????}?else?{
????????????????????????star.src?=?"img/2.jpg";
????????????????????????flag?=?true;
????????????????????}
????????????????}
????????????}
function?HTMLdom(){
????????????????var?divh=document.getElementById("divh");
????????????????divh.innerHTML?+="<input?type='text'>";
//?樣式
????????????????divh.οnclick=function(){
????????????????????divh.style.border="5px?solid?red";
????????????????????divh.style.fontSize="20px";
????????????????}???????????????
????????????????var?divh2=document.getElementById("divh2");
????????????????divh2.οnclick=function(){
????????????????divh2.className="divh2";
????????????}
????????}
????????function?things(){
????????????document.getElementById("blur").οnblur=function(){
????????????????document.write("lost");
????????????}
????????????document.getElementById("change").οnchange=function(){
????????????????alert("change");
????????????}
????????}
????????
????????
????</script>
</body>
</html>
總結
- 上一篇: 真武三国java_2010年CPU第三季
- 下一篇: h sm2 曲线参数_磁测量常用专业术语