為什麼點(diǎn)取消了還開(kāi)新視窗?
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title>??
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?
? <script type="text/javascript">??
? ? function openWindow(){
? ? ? ? var mymesenge=confirm('是否開(kāi)啟新網(wǎng)站');
? ? ? ? if(mymesenge='true')
? ? ? ? {
? ? ? ? window.open('http://idcbgp.cn/','width=400,height=500,menubar=no,toolbar=no');
? ? ? ? }
? ? ? ? else
? ? ? ? {
? ? ? ? ? ?mymesenge.close();?
?? ? ? ?}
? ? }
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開(kāi)網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2019-03-18
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title>??
? <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>? ?
? <script type="text/javascript">??
? ? function openWindow(){
? ? ? ? var mymesenge=confirm('是否開(kāi)啟新網(wǎng)站');
? ? ? ? if(mymesenge==true)
? ? ? ? {
? ? ? ? window.open('http://idcbgp.cn/','width=400,height=500,menubar=no,toolbar=no');
? ? ? ? }
? ? ? ? else
? ? ? ? {
? ? ? ? ? ?mymesenge.close();?
? ? ? ? }
? ? }
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開(kāi)網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2019-03-15
一個(gè)等號(hào)=是表示賦值,要表示判斷的話選用三個(gè)等號(hào)'==='的強(qiáng)模式
2019-03-15
?if(mymesenge='true')這里應(yīng)該?if(mymesenge==true) 把=賦值 改成等于== 單引號(hào),應(yīng)該沒(méi)有吧、俺也是新手
2019-03-14
if(mymesenge='true')這里更改為if(mymesenge=='true')試試