prompt(str,str2)。str1是消息框中文本。str2是输入框中文本,如果初始输入框为空也不要省略str2,应写上分号"",若省略则输入框中显示default。
例如score=prompt("请输入你的分数","")
例如score=prompt("请输入你的分数","")
2015-07-17
function openWindow(){
var n=confirm("是否打开?");
if(n==true){
var a=prompt("请输入网址","http://www.baidu.com");
}if(a=="http://www.baidu.com"){
window.open("http://www.baidu.com","_blank","width=400,height=500,menubar=no,toolbar=no");
}
}
var n=confirm("是否打开?");
if(n==true){
var a=prompt("请输入网址","http://www.baidu.com");
}if(a=="http://www.baidu.com"){
window.open("http://www.baidu.com","_blank","width=400,height=500,menubar=no,toolbar=no");
}
}
消息对话框:prompt(str1,str2);str1,要显示在消息对话框中的文本,不可修改 ;str2:文本框中的输入内容,可以重新输入
返回值:点击确定按钮,文本框中的内容将作为函数返回值,取消按钮将返回null
返回值:点击确定按钮,文本框中的内容将作为函数返回值,取消按钮将返回null
2015-07-17
mychar.style.color="red";
mychar.style.backgroundColor="Gray"
mychar.style.width="300";
mychar.style.backgroundColor="Gray"
mychar.style.width="300";
2015-07-17
确认对话框:confirm(str);str,在消息框中要显示的文本,返回bool。点击确定返回true,点击取消返回false
2015-07-17
document.write(""或者变量名),document.write(***+***);用加号连接。可以写入html标签,起作用。
2015-07-17
<input type="button" value="点击" onclick="add2()">
添加点击事件。然后
写函数调用。
添加点击事件。然后
写函数调用。
2015-07-17
我不加<script type="text/javascript">这句,能够运行出开启JS之旅,加了之后,反而运行不出来耶
2015-07-17