<script type="text/javascript">
function rec(){
var mymessage= confirm("你喜欢我吗?") ;
if(mymessage==true)
{
document.write("你果然喜欢我!");
}
else
{
document.write("你敢不喜欢我试试!");
}
}
</script>
function rec(){
var mymessage= confirm("你喜欢我吗?") ;
if(mymessage==true)
{
document.write("你果然喜欢我!");
}
else
{
document.write("你敢不喜欢我试试!");
}
}
</script>
2016-08-18
想点击确定后转到另一个网页就把document.write("");这句话改成window.location.href="tree.jsp";就可以了,tree.jsp就是你要跳到的目标页面
2016-08-18
document.write("hello"); 第一行代码就是在网页上再输出一段文字,就是引号里的hello。
document.getElementById("p1").style.color="blue";第二行代码是指获取id为p1的元素,并且将它的颜色样式改为引号里的样式,就是蓝色
document.getElementById("p1").style.color="blue";第二行代码是指获取id为p1的元素,并且将它的颜色样式改为引号里的样式,就是蓝色
2016-08-18
<input type="button" value="改变颜色" onclick="changeColor();">
<input type="button" value="改变宽高" onclick="change_Wid_And_Hei();">
<input type="button" value="隐藏内容" onclick="hiddenContent();">
<input type="button" value="改变宽高" onclick="change_Wid_And_Hei();">
<input type="button" value="隐藏内容" onclick="hiddenContent();">
function openWindow(){
var mymessage = confirm("确定打开新窗口吗?");
if(mymessage = true){
var site = prompt("请输入网址:","http://www.imooc.com");
window.open(site,'_blank','width=400,height=500,menubar=no,toolbar=no')
}
}
var mymessage = confirm("确定打开新窗口吗?");
if(mymessage = true){
var site = prompt("请输入网址:","http://www.imooc.com");
window.open(site,'_blank','width=400,height=500,menubar=no,toolbar=no')
}
}
赋值主要是两种,一种是字符串,一种是数值,字符串可以理解为文本类型的,数值就是数值,字符串需要用“”,而数值不用。例如var mynum=69 和var mynum="69"就是不一样的,虽然最后的显示效果是一样的,但是实际上是不同的。
2016-08-18