Eclipse執(zhí)行不了JS里面的function函數(shù)
<!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://idcbgp.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好像不能識(shí)別JS代碼,運(yùn)行web項(xiàng)目之后也執(zhí)行了Html語句,這個(gè)應(yīng)該怎么解決?
答:if-else函數(shù)里面;號放在{}后面
---------------------------------------------------------------------------------------------------
以下是能成功運(yùn)行的代碼,我也不知道哪里錯(cuò)了,但是輸入網(wǎng)址后點(diǎn)擊確定,404,而且第一個(gè)if的else語句執(zhí)行不了,點(diǎn)擊取消則無任何反應(yīng),若想執(zhí)行else應(yīng)該怎么寫?(目前只想到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://idcbgp.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
沒人嗎?