// 點擊事件
document.getElementById('dj').onclick = function(){
alert('點擊')
}
// 失去焦點
document.getElementById('inp').onblur = function(){
console.log('失去焦點');
}
// 獲取焦點
document.getElementById('inp').onfocus = function(){
console.log('獲取焦點');
}
// 添加新元素
// var p = document.createElement('p'); //創建一個新元素
// var nod = document.createTextNode('新段落');//創建一個新文本節點
// p.appendChild(nod);//拼接起來
// document.getElementById('dj').appendChild(p); //添加到元素中
// document.getElementById('but').onclick = function(){
//刪除元素
// var parent = document.getElementById('dj'); //找到父級div
// var child = document.getElementById('dl');//找到元素
// parent.removeChild(child);
//替換元素
// var para = document.createElement("p");
// var node = document.createTextNode("這是新文本。");
// para.appendChild(node);
// var parent = document.getElementById("dj");
// var child = document.getElementById("dl");
// parent.replaceChild(para, child);
// }
// 定時器輪播圖
// var i= 1;
// var t =setInterval(function(){
// if(i==1){
// document.getElementById('img').src = '../ujx.jpg';
// }else{
// document.getElementById('img').src = '../QQ_05.jpg';
// }
// if(i==2){
// i=0;
// }
// i++;
// },1000)
// 取消定時
// document.getElementById('but').onclick = function(){
// clearInterval(t);
// }
setTimeout(function(){ },1000);這個是延遲執行
clearTimeout();取消定時;取消延遲執行
// 頁面跳轉
// document.getElementById('but').onclick = function(){
// window.location.href='http://www.baidu.com'
// }
// 滾動條的位置
// scrollTo(0,0);
//滾動條y軸位置
// scrollY
//滾動條X軸位置
// scrollX