不明白為什么點擊沒有彈出框?
<head>
<title></title>
<!--引入外部文件的方式-->
<script type="text/script" scr="script.js"></script>
</head>
<body>
? ? <p>系好安全帶,準備啟航--目標JS</p>
? ? <input type="button" value="點擊進入" onclick="mn()">
</body>
</html>
//編寫JS代碼
? ? function mn(){
? ? var mk=confirm("準備好了,起航吧!");
? ? if(mk==true){
? ? ? ? alert("那出發(fā)吧!");
? ? }
? ? else{
? ? ? ? alert("很遺憾,你錯過了一個億!");
? ? }
? ? }
2017-07-26
2017-08-13
我的天 引用文件那錯了 是? src? 你寫成 scr了
2017-08-07
我復制你的都可以出來
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>系好安全帶,準備啟航</title>
<!--引入外部文件的方式-->
<script type="text/javascript" src="script.js">
</script>
</head>
<body>
? ? ?<p>系好安全帶,準備啟航--目標JS</p>
? ? <input type="button" value="點擊進入" onclick="mn()">
</body>
</html>
JS:
//編寫JS代碼
? ? function mn(){
? ? var mk=confirm("準備好了,起航吧!");
? ? if(mk==true){
? ? ? ? alert("那出發(fā)吧!");
? ? }
? ? else{
? ? ? ? alert("很遺憾,你錯過了一個億!");
? ? }
? ? }
2017-07-26
沒毛病的語句。。。我復制你的代碼試了下沒毛病
2017-07-26
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>系好安全帶,準備啟航</title>
<!--引入外部文件的方式-->
<script ?src="script.js" type="text/javascript">
</script>
</head>
<body>
? ? <input type="button" onclick="mn()" value="點擊進入"/>
</body>
</html>
//編寫js
function mn(){
? ? var mk=confirm("準備好了,起航吧!");
? ? //alert(confirm("準備好了,起航吧!")); test
? ? if(mk==true || mk=="準備好了,起航吧!"){
? ? ? ? alert("那出發(fā)吧!");
? ? }
? ? else{
? ? ? ? alert("很遺憾,你錯過了一個億!");
? ? }
? ? }
2017-07-26
不行,還是沒辦法。。。。。。。。。。。。。
2017-07-26
function(){}這部分必須寫在<script type="text/javascript"></script>語句之間,否則不起作用
2017-07-26
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>系好安全帶,準備啟航</title>
<!--引入外部文件的方式-->
<script ?src="script.js" type="text/javascript">
</script>
</head>
<body>
? ? <input type="button" onclick="jump()" value="點了試試"/>
</body>
</html>
//編寫JS代碼
document.write("系好安全帶,準備啟航--目標JS")
function jump(){
? ? alert("準備好了,起航吧!")
}