function openWindow(){
var a = confirm("是否開新窗口");
if( a == true){
var b = prompt("確認網址","www.xianlaiwan.cn");
if (b != null){
window.open('http://www.xianlaiwan.cn','_blank','width=400,height=500,menubar=no,toolbar=no');
}
}
}
var a = confirm("是否開新窗口");
if( a == true){
var b = prompt("確認網址","www.xianlaiwan.cn");
if (b != null){
window.open('http://www.xianlaiwan.cn','_blank','width=400,height=500,menubar=no,toolbar=no');
}
}
}
var mychar= document.getElementById("con");
mychar.style.color="red";
mychar.style.background="#CCC";
mychar.style.width="500px";
mychar.style.color="red";
mychar.style.background="#CCC";
mychar.style.width="500px";
2015-12-10
<script type="text/javascript">
var mystr="我是";
document.write(mystr+"<span style='white-space:pre'>"+"1 2 3"+"</span>");
</script>
var mystr="我是";
document.write(mystr+"<span style='white-space:pre'>"+"1 2 3"+"</span>");
</script>
2015-12-10
var aa = prompt("輸入要打開的網址");
if(aa!=null){
window.open('http://www.baidu.com/','_blank','width=400,height=500,menubar=no,toolbar=no');
}else{
window.open('http://www.xianlaiwan.cn');
}
為什么默認網址顯示不是 http://www.xianlaiwan.cn/,各位高手們給解答一下
if(aa!=null){
window.open('http://www.baidu.com/','_blank','width=400,height=500,menubar=no,toolbar=no');
}else{
window.open('http://www.xianlaiwan.cn');
}
為什么默認網址顯示不是 http://www.xianlaiwan.cn/,各位高手們給解答一下
注意-->JS中調用樣式時,使用連字符的屬性名稱需要改為駝峰式的名稱才能正常使用,如mychar.style.backgroundColor,css中的background-color要更改為backgroundColor,去連字符,第二個單詞首字母大寫。
2015-12-09
//定義"隱藏內容"的函數
function hideCOntext(){
var hid=document.getElementById("txt");
hid.style.display="none";}
//定義"顯示內容"的函數
function display(){
var disp=document.getElementById("txt");
disp.style.display="block";}
function hideCOntext(){
var hid=document.getElementById("txt");
hid.style.display="none";}
//定義"顯示內容"的函數
function display(){
var disp=document.getElementById("txt");
disp.style.display="block";}
//定義"改變顏色"的函數
function changeColor(){
var txColor=document.getElementById("txt");
txColor.style.color="green";
txColor.style.backgroundColor="pink";}
//定義"改變寬高"的函數
function changeWH(){
var cWH=document.getElementById("txt");
cWH.style.height="300px";
cWH.style.width="200px";}
function changeColor(){
var txColor=document.getElementById("txt");
txColor.style.color="green";
txColor.style.backgroundColor="pink";}
//定義"改變寬高"的函數
function changeWH(){
var cWH=document.getElementById("txt");
cWH.style.height="300px";
cWH.style.width="200px";}
<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>
2015-12-09
<script type="text/javascript">
function rec(){
var mychar="I love JavaScript";
alert(mychar);
}
</script>
function rec(){
var mychar="I love JavaScript";
alert(mychar);
}
</script>
2015-12-09
function openWindow(){
var open=confirm("確定打開新窗口?");
if(open==true){var openConfirm=prompt("確定打開以下網址?","http://www.xianlaiwan.cn/");
if(openConfirm !=null){window.open('http://www.xianlaiwan.cn/','_blank','width=400px,height=500px,menubar=no,toolbar=no')}else{}} else{}}
var open=confirm("確定打開新窗口?");
if(open==true){var openConfirm=prompt("確定打開以下網址?","http://www.xianlaiwan.cn/");
if(openConfirm !=null){window.open('http://www.xianlaiwan.cn/','_blank','width=400px,height=500px,menubar=no,toolbar=no')}else{}} else{}}
function openWindow(){
var open=confirm("打開新窗口");
if(open==true)
{
window.open('http://www.xianlaiwan.cn/','_blank','width=400px,height=500px,menubar=no,toolbar=no')
}
else{
}
}
var open=confirm("打開新窗口");
if(open==true)
{
window.open('http://www.xianlaiwan.cn/','_blank','width=400px,height=500px,menubar=no,toolbar=no')
}
else{
}
}