JavaScript中confirm,alert,prompt的用法
本文简要介绍JavaScript中confirm,alert,prompt的用法,希望大家学习过程中能得到一些启发。
window.confirm 参数就只有一个。显示提示框的信息。按确定,返回true;按取消返回false。
< SCRIPT> var bln = window.confirm("确定吗?"); alert(bln) < /SCRIPT> window.alert参数,只有一个,显示警告框的信息;无返回值。
< SCRIPT> window.alert("确定。") window.prompt参数,有两个,第一个参数,显示提示输入框的信息。第二个参数,用于显示输入框的默认值。返回,用户输入的值。
< SCRIPT> var str = window.prompt("请输入密码","password") alert(str); < /SCRIPT>
相关文档:
首先在body中加入以下HTML内容:
<div id="panel">
<div id="top">
<ul id="menu">
<li id="1">Home</li>
&nbs ......
to make a note that I love JavaScript. This article is only meant for some fun, and for us to be aware of some its short-comings.
1. The Name. JavaScript is NOT Java
We'll start with a fun jab at the name choice. While it was originally called Mocha, and then LiveScript, it was later changed to J ......
//创建一个新的元素节点,元素名使用sTagName定义
oElementNode = document.createElementNode(sTagName);
//创建一个新的节点,节点名使用sTextValue定义
oTextNode = document.createTextNode(sTextValue);
//为元素赋一个新的属性,属性名使用sName
oAttribute = document.createAttribute(sName);
//创建一个新的 ......
选择元素:document.getElementsByTagName,document.getElementsById,document.getElementsByName。
firstChild,lastChild,nextSibling,previousSibling
创建元素:document.createElement(),appendChild();
删除元素:removeC ......
本文主要介绍如何动态的增加、删除输入框,并获取输入框中的值~~
<html>
<head>
<title>JavaScript_动态增加/删除输入框_阿方索</title>
<script type="text/javascript">
<!--
var idNumber = 1,id="tableAFS";
function addTextBox() {
idNumber++;
//这里我们创建一个lab ......