Eclipse執行不了JS里面的function函數
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
?<meta http-equiv="Content-Type" content="text/html; charset=gbk"/>?
<title>Insert title here</title>
<script type="text/javascript">
function button1()?
{
var message1=confirm("please choose yes ro no?");
if(message1==true)
{
var message2=prompt("please enter your website","http://www.xianlaiwan.cn/");
if(message2!=null)
{var message3=window.open('message2','width=400,height=500,menubar=no,toolbar=no')};
else
{document.write("bye1")};
}
else
{document.wriet("bye2!")};
}
</script>
</head>
<body>
<input type="button" value="打開" onclick="button1()" />
</body>
</html>
Eclipse好像不能識別JS代碼,運行web項目之后也執行了Html語句,這個應該怎么解決?
答:if-else函數里面;號放在{}后面
---------------------------------------------------------------------------------------------------
以下是能成功運行的代碼,我也不知道哪里錯了,但是輸入網址后點擊確定,404,而且第一個if的else語句執行不了,點擊取消則無任何反應,若想執行else應該怎么寫?(目前只想到alert彈窗)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
?<meta http-equiv="Content-Type" content="text/html; charset=gbk"/>?
<title>Insert title here</title>
<script type="text/javascript">
function button1()
{
var message1=confirm("please choose yes ro no?");
if(message1==true)
{
var message2=prompt("please enter your website","http://www.xianlaiwan.cn/");
if(message2!=null)
{var message3=window.open('message2','width=400,height=500,menubar=no,toolbar=no');}
else
{document.write("bye1");}
}
else
{document.wriet("bye2!");}
}
</script>
</head>
<body>
<input type="button" value="打開" onclick="button1()" />
</body>
</html>
2019-08-17
Eclipse 不是Java軟件嗎?為什么不選適用Javascript的
2019-08-07
沒人嗎?