DOM对象操作HTML元素和消息对话框(alert,confirm,prompt)(二)
如果你是真的学习请把下面的敲一遍
<div id="divid">
<p id="pid">div内的p元素</p>
nihaoya
</div>
function getParentNode(){
var childNode=document.getElementById("pid");
var parentnode = childNode.parentNode;
alert(parentnode.nodeName);
}
function createElementNode(){
var body=document.body;
var input=document.createElement("input");
input.type="button";
input.value="按钮";
input.οnclick=function(){
alert("我是使用document.createElement(\"input\")创建的一个按钮");
}
body.appendChild(input);
}
function createTextNode(){
var body=document.body;
var text=document.createTextNode("wojiaoyangmaotou");
body.appendChild(text);
}
function insertBefore(){
var div=document.getElementById("divid");
var pid=document.getElementById("pid");
var childnode=document.createTextNode("输入的用户名或密码错误");
div.insertBefore(childnode,pid);
}
function removechild(){
var div=document.getElementById("divid");
var pid=document.getElementById("pid");
div.removeChild(pid);
}
function getsize(){
var width=document.body.offsetWidth||document.documentElement.offsetWidth;
var height=document.body.offsetHeight||document.documentElement.offsetHeight;
alert(width+","+height);
}
//getParentNode();
//createElementNode();
//createTextNode();
//insertBefore();
//removechild();
getsize();
转载于:https://www.cnblogs.com/YangMT/p/4864020.html
- 点赞
- 收藏
- 分享
- 文章举报
- 八、处理alert、confirm、prompt对话框(针对于点击’删除’按钮,需要的操作)
- 对话框操作_Alert、confirm、Prompt控件操作
- selenium webdriver学习(七)------------如何处理alert、confirm、prompt对话框( 转)
- JQuery插件:alert、confirm、prompt对话框插件
- javascript学习笔记(十六) 系统对话框(alert、confirm、prompt)
- Python脚本控制的WebDriver 常用操作 <二十二> 处理alert / confirm / prompt
- selenium webdriver学习(一)---如何处理alert、confirm、prompt对话框
- html对话框alert,confirm,prompt用法汇总
- 在Android的webview中定制js的alert,confirm和prompt对话框的方法
- jquery仿alert提示框、confirm确认对话框、prompt带输入的提示框插件[附实例演示]
- Android WebView封装及定制js的alert,confirm和prompt对话框的方法
- 在Android的webview中定做js的alert,confirm和prompt对话框的方法
- WebDriver拾级而上·之七 处理对话框alert\confirm\prompt
- selenium webdriver学习(七)------------如何处理alert、confirm、prompt对话框
- WebDriver拾级而上·之七 处理对话框alert\confirm\prompt
- Android webview中定制js的alert,confirm和prompt对话框的方法 (处理webview 带网站地址的弹出框)
- 在Android的webview中定制js的alert,confirm和prompt对话框的方法
- selenium webdriver学习(七)------------如何处理alert、confirm、prompt对话框
- 在Android的webview中定制js的alert,confirm和prompt对话框的方法
- 对话框(alert,prompt,confirm,showModalDialog)