var mychar=document.getElementById("con");
document.write("结果:"+mychar.innerHTML);
document.write("结果:"+mychar.innerHTML);
2016-05-07
已采纳回答 / 满天星1051828
在HTML5规范中,script的type属性默认是text/javascript,所以可以省略;但是在HTML 4.01和XHTML 1.0规范中,type属性是必须的。写上可以明确指示浏览器按照何种脚本以及何种版本加载和解析脚本,可以有效避免兼容性或者版本差异造成的错误。
2016-05-07
...........这验证机制好奇怪...自己练写代码,下面的onclick参数值只能写原来默认的,不管你自己上面设置的是什么函数名,,,,害我查半天查不到自己出错在哪。
2016-05-06
//定义"取消设置"的函数
function qx()
{ var e=confirm("是否取消设置?");
if(e==true)
{var f=document.getElementById('txt');
f.style.color="#000";
f.style.backgroundColor="#fff";
f.style.width="600px";
f.style.height="400px";
f.style.display="block";
}
else{}
}
function qx()
{ var e=confirm("是否取消设置?");
if(e==true)
{var f=document.getElementById('txt');
f.style.color="#000";
f.style.backgroundColor="#fff";
f.style.width="600px";
f.style.height="400px";
f.style.display="block";
}
else{}
}
function add(){
var p1 = document.getElementById("p1");
p1.className="one";
}
function modify(){
var p2 = document.getElementById("p2");
p2.className="two";
}
var p1 = document.getElementById("p1");
p1.className="one";
}
function modify(){
var p2 = document.getElementById("p2");
p2.className="two";
}
2016-05-06
function openWindow()
{
var mystr=confirm("是否打开新窗口?");
if(mystr==true)
{
prompt("确定打开的网址为?","http://www.imooc.com");
window.open("http://www.imooc.com","_blank","width=400,height=500,menubar=no,toolbar=no")
}
else{
}
}
{
var mystr=confirm("是否打开新窗口?");
if(mystr==true)
{
prompt("确定打开的网址为?","http://www.imooc.com");
window.open("http://www.imooc.com","_blank","width=400,height=500,menubar=no,toolbar=no")
}
else{
}
}
var a = confirm("你是煞笔吗");
if(a==true){
document.write("你很诚实!");
}else{
document.write("你很聪明!");
}
if(a==true){
document.write("你很诚实!");
}else{
document.write("你很聪明!");
}
2016-05-06
function openWindow(){
var zzz=prompt("http://www.imooc.com/","请输入网址")
if(zzz!=null)
{
window.open(zzz,'_blank','width=400,height=500,menubar=no,toolbar=no');
}
else{
window.close();
}
}
var zzz=prompt("http://www.imooc.com/","请输入网址")
if(zzz!=null)
{
window.open(zzz,'_blank','width=400,height=500,menubar=no,toolbar=no');
}
else{
window.close();
}
}