已采纳回答 / Perona
表示id名为p1。因为document.getElementById("p1").style.color="blue"; 是通过id名为p1获取p元素的。
2015-07-18
function hidetext()
{
var mychar = document.getElementById("con").style.display="none";
}
function showtext()
{
var mychar = document.getElementById("con").style.display="block";
}
{
var mychar = document.getElementById("con").style.display="none";
}
function showtext()
{
var mychar = document.getElementById("con").style.display="block";
}
2015-07-18
function openWindow() {
if (confirm('是否打开新窗口')) { window.open("http://www.baidu.com","_blank","width=400,height=500,menubar=no,toolbar=no");
}
}
if (confirm('是否打开新窗口')) { window.open("http://www.baidu.com","_blank","width=400,height=500,menubar=no,toolbar=no");
}
}
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