顯示不是<結果:JavaScript>
而是<JavaScript
結果:[object HTMLParagraphElement]>
0.0
而是<JavaScript
結果:[object HTMLParagraphElement]>
0.0
2015-10-01
function openWindow(){ var newl=confirm('是否打開新網頁?') if(newl==true){ var wangzhi=prompt('請輸入網址:http://www.xianlaiwan.cn/') if(wangzhi=="http://www.xianlaiwan.cn/"){
window.open('http://www.xianlaiwan.cn/','width=400px,height=500px,menubar=no,toolbar=no')}
else{ null } }else{ null } }打開的窗口為啥不對
window.open('http://www.xianlaiwan.cn/','width=400px,height=500px,menubar=no,toolbar=no')}
else{ null } }else{ null } }打開的窗口為啥不對
function openWindow(){
if(confirm("?")) {
window.open(prompt("請輸入要打開的地址","http://www.xianlaiwan.cn/"),'width=400,height=500,menubar=no,toolbar=no')
}
if(confirm("?")) {
window.open(prompt("請輸入要打開的地址","http://www.xianlaiwan.cn/"),'width=400,height=500,menubar=no,toolbar=no')
}
function openWindow()
{
var mywin;
mywin=confirm("是否打開?");
if(mywin=true){
my=prompt("請輸入要打開網址","http://www.xianlaiwan.cn");
window.open('http://www.xianlaiwan.cn','width=400','height=500','menubar=no','toolbar=no');
}else{
null;
}
}
{
var mywin;
mywin=confirm("是否打開?");
if(mywin=true){
my=prompt("請輸入要打開網址","http://www.xianlaiwan.cn");
window.open('http://www.xianlaiwan.cn','width=400','height=500','menubar=no','toolbar=no');
}else{
null;
}
}
function hidetext()
{
var mychar = document.getElementById("con");
mychar.style.display="none";
}
function showtext()
{
document.getElementById("con").style.display="block";
}
{
var mychar = document.getElementById("con");
mychar.style.display="none";
}
function showtext()
{
document.getElementById("con").style.display="block";
}
2015-09-29
var mychar=document.getElementById("con")/*這樣輸入是獲取id為con所屬元素,所以結果才會是:object HTMLParagraphElement(對象 HTML <P>元素)*/
document.write("結果:"+mychar);
var mychar=document.getElementById("con").innerHTML;
document.write(mychar) /*這樣輸入才是得到id為con的p元素里的文本內容 我也是新手,不懂的別著急,細心點就好了*/
document.write("結果:"+mychar);
var mychar=document.getElementById("con").innerHTML;
document.write(mychar) /*這樣輸入才是得到id為con的p元素里的文本內容 我也是新手,不懂的別著急,細心點就好了*/
2015-09-28
function openWindow()
{
var mywin=confirm("是否打開");
var mywin=prompt("請輸入要打開網址","http://www.xianlaiwan.cn")
if(mywin=="http://www.xianlaiwan.cn")
{
window.open("http://www.xianlaiwan.cn","_blank","width=400,height=500,menubar=no,toolbar=no");
}
else
{
null;
}
}
{
var mywin=confirm("是否打開");
var mywin=prompt("請輸入要打開網址","http://www.xianlaiwan.cn")
if(mywin=="http://www.xianlaiwan.cn")
{
window.open("http://www.xianlaiwan.cn","_blank","width=400,height=500,menubar=no,toolbar=no");
}
else
{
null;
}
}
var duanwei=prompt("你是大神嗎?告訴我你的隱藏分數");
if(duanwei>=2200)
{
document.write("大神,請收下我的膝蓋!");
}
else if(duanwei>=1600)
{
document.write("哎呦,不錯哦,你可以在白金鉆石掌控雷電了!");
}
else
{
document.write("你活著的意義?說出你的故事!");
}
if(duanwei>=2200)
{
document.write("大神,請收下我的膝蓋!");
}
else if(duanwei>=1600)
{
document.write("哎呦,不錯哦,你可以在白金鉆石掌控雷電了!");
}
else
{
document.write("你活著的意義?說出你的故事!");
}
2015-09-28
function weather()
{
var tianqi=confirm("hotorcold?");
if(tianqi==true)
{
document.write(tianqi+"<br>"+"so hot!");
}
else
{
document.write(tianqi+"<br>"+"woshisb,I can't feel it");
}
}
<input type="button" value="傳統是智慧的糟粕" onclick="weather()">
{
var tianqi=confirm("hotorcold?");
if(tianqi==true)
{
document.write(tianqi+"<br>"+"so hot!");
}
else
{
document.write(tianqi+"<br>"+"woshisb,I can't feel it");
}
}
<input type="button" value="傳統是智慧的糟粕" onclick="weather()">
2015-09-28
javascript作為一種腳本語言可以放在html頁面中任何位置,但是瀏覽器解釋html時是按先后順序的,所以前面的script就先被執行。比如進行頁面顯示初始化的js必須放在head里面,因為初始化都要求提前進行(如給頁面body設置css等);而如果是通過事件調用執行的function那么對位置沒什么要求的。
2015-09-28