confirm 消息對話框通常用于允許用戶做選擇的動作,如:“你對嗎?”等。彈出對話框(包括一個確定按鈕和一個取消按鈕)。
2015-11-09
function rec(){
var mymessage=confirm("你是高富帥嗎?") ;
if(mymessage==true)
{
document.write("你是高富帥!");
}
else
{
document.write("你是屌絲!");
}
}
var mymessage=confirm("你是高富帥嗎?") ;
if(mymessage==true)
{
document.write("你是高富帥!");
}
else
{
document.write("你是屌絲!");
}
}
2015-11-09
//定義"取消設置"的函數
function rec(){
var mymessage=confirm("是否取消設置?");
if(mymessage==true){
var mycon=document.getElementById("con");
var mytxt=document.getElementById("txt");
mytxt.removeAttribute("style");
mycon.removeAttribute("style");
}
function rec(){
var mymessage=confirm("是否取消設置?");
if(mymessage==true){
var mycon=document.getElementById("con");
var mytxt=document.getElementById("txt");
mytxt.removeAttribute("style");
mycon.removeAttribute("style");
}
document.getElementById(“id”) 這條語句獲取的是元素,包含開始標簽到結束標簽所有內容。想要輸出元素內容需要在其后尾使用.innerHTML /*innerHTML看它的英文單詞也可以明白就是里面的字符按html標記的語言格式取出來*/
2015-11-08
<script type="text/javascript">
function Wopen(){
window.open('http://www.xianlaiwan.cn','_blank','top=100,left=0,width=600,height=400');
}
</script>
function Wopen(){
window.open('http://www.xianlaiwan.cn','_blank','top=100,left=0,width=600,height=400');
}
</script>
2015-11-07