根本不需要输入其他任何东西,按照上面步骤就会有输出,只是有一个单词大家注意了 这里的getElementById “I”是大写,“d”是小写
2016-03-04
function openWindow(){
if(confirm("是否打开"))
{
if(prompt("请输入网站:","http://www.imooc.com/"))
{
window.open("http://www.imooc.com/","_self","width=400,height=500,menubar=no,toolbar=no");
}
else{alert("已取消");}
}
else{
alert("已取消");
};
}
if(confirm("是否打开"))
{
if(prompt("请输入网站:","http://www.imooc.com/"))
{
window.open("http://www.imooc.com/","_self","width=400,height=500,menubar=no,toolbar=no");
}
else{alert("已取消");}
}
else{
alert("已取消");
};
}
<p id="con">JavaScript</p>
<script type="text/javascript">
var mychar=document.getElementById("con") ;
document.write("结果:"+mychar); //输出获取的P标签。
</script>
<script type="text/javascript">
var mychar=document.getElementById("con") ;
document.write("结果:"+mychar); //输出获取的P标签。
</script>
2016-03-04
//定义"取消设置"的函数
function cancelSetting(){
if(confirm("是否取消设置?")){
document.getElementById("txt").style="";
}
}
function cancelSetting(){
if(confirm("是否取消设置?")){
document.getElementById("txt").style="";
}
}
最赞回答 / 慕莱坞9188085
你好,eg: var mychar=document.getElementById("con"); 那么mychar里面的内容也就是得到的这个id标签
2016-03-04
function rec(){
var mymessage=confirm("你是MM还是GG哇?") ;
if(mymessage==true)
{
document.write("你是女士!");
}
else
{
document.write("你是男士!");
}
}
var mymessage=confirm("你是MM还是GG哇?") ;
if(mymessage==true)
{
document.write("你是女士!");
}
else
{
document.write("你是男士!");
}
}
2016-03-04
var mychar= document.getElementById("con"); ;
document.write("原标题:"+mychar.innerHTML+"<br>"); //输出原h2标签内容
mychar.innerHTML="hello world"
document.write("修改后的标题:"+mychar.innerHTML);
document.write("原标题:"+mychar.innerHTML+"<br>"); //输出原h2标签内容
mychar.innerHTML="hello world"
document.write("修改后的标题:"+mychar.innerHTML);
2016-03-04
最新回答 / zczzhang
<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>JS代码的位置</title><script type="text/javascript"> document.write("I Love") 这段是不是打错了,如果字母打错了也输出不了哦你要是错了就会到倒过来你...
2016-03-04
function onpenWindow(){
confirm("是否打开新窗口");
if(confirm()==true){
prompt("确认打开的网址"," http://www.imooc.com/");
if(prompt()==true){
window.open("prompt.value","_blank,","width=400,height=500,menubar-no,toolbar=no")
}
}
}
confirm("是否打开新窗口");
if(confirm()==true){
prompt("确认打开的网址"," http://www.imooc.com/");
if(prompt()==true){
window.open("prompt.value","_blank,","width=400,height=500,menubar-no,toolbar=no")
}
}
}
已采纳回答 / 重晚情
第一个输出的原来的内容,第二个输出的修改后的内容,直接对mychar.innerHTML进行的改动,然后再次输出,这两个document本身的功能一样,只是输出的内容不一样
2016-03-04
<script type="text/javescript">
function hidetext(){
varchar=document.getElementById("con");
mychar.style.display="none";
}
function showtext(){
var mychar=document.getElementById("con");
mychar.style.display="block";
}
</script>
function hidetext(){
varchar=document.getElementById("con");
mychar.style.display="none";
}
function showtext(){
var mychar=document.getElementById("con");
mychar.style.display="block";
}
</script>
2016-03-04