function openWindow(){
var ifOpen = confirm("are you sure open it?");
if(ifOpen)
{
var webaddress = prompt("input","http://www.xianlaiwan.cn");
window.open(webaddress,"_blank","width=400,height=500,menubar=no,toolbar=no");
}
}
var ifOpen = confirm("are you sure open it?");
if(ifOpen)
{
var webaddress = prompt("input","http://www.xianlaiwan.cn");
window.open(webaddress,"_blank","width=400,height=500,menubar=no,toolbar=no");
}
}
function openWindow(){
var newWin = confirm("是否打開新窗口?");
if(newWin==true){
var newWindow = prompt('');
window.open(newWindow);
}else
newWin.close();
}
var newWin = confirm("是否打開新窗口?");
if(newWin==true){
var newWindow = prompt('');
window.open(newWindow);
}else
newWin.close();
}
//定義"改變顏色"的函數
function qq(){
var vic=document.getElementById("con");
vic.style.color="red";
vic.style.background="#ccc";
}
//定義"改變寬高"的函數
function ww(){
var viv=document.getElementById("txt");
viv.style.width="300px";
viv.style.height="300px";
}
function qq(){
var vic=document.getElementById("con");
vic.style.color="red";
vic.style.background="#ccc";
}
//定義"改變寬高"的函數
function ww(){
var viv=document.getElementById("txt");
viv.style.width="300px";
viv.style.height="300px";
}
<script type="text/javascript">
function add(){
var p1 = document.getElementById("p1");
id="p1";
p1.className="one";
}
function modify(){
var p2 = document.getElementById("p2");
id="p2";
p2.className="two";
}
function add(){
var p1 = document.getElementById("p1");
id="p1";
p1.className="one";
}
function modify(){
var p2 = document.getElementById("p2");
id="p2";
p2.className="two";
}
2015-12-18
document.getElementById(“id”) 這條語句獲取的是元素,包含開始標簽到結束標簽所有內容。想要輸出元素內容需要在其后尾使用.innerHTML /*innerHTML看它的英文單詞也可以明白就是里面的字符按html標記的語言格式取出來*/
2015-12-18
document.write("Hello");
document.write(" world");
在“”中間加個空格就會是hello world了
document.write(" world");
在“”中間加個空格就會是hello world了
2015-12-18