這個到底哪里錯了呀,和別人的是一樣的 別人的復制進來就可以顯示 自己手敲的就不行
<script type="text/javascript">
//多行注釋
? /*我是多行注釋!
? 我需要隱藏,
? 否則會報錯哦!
*/
//在頁面中顯示文字
document.write("系好安全帶,準備起航。目標js"+<br>)
//頁面中彈出提示框
function con(){
? ? var txt=confirm("請點擊我,準備好了嗎?");
? ?if(txt==true)
? ? ? ? ?{document.write("準備好了,起航吧!")}
? ? }
? ? else{
? ? ? ? document.write("重新學習課程內容")
? ? }
}
//單行注釋
? // 我是單行注釋,我也要隱藏起來!
</script>
</head>
<body>
</body>
<input type="button" onclick="con" value"請點擊我" >
</input>
</html>
2016-04-23
<script type="text/javascript">
? ? //多行注釋
? ? /*我是多行注釋!
? ? 我需要隱藏,
? ? 否則會報錯哦!
? */
? ? //在頁面中顯示文字
? ? document.write("系好安全帶,準備起航。目標js" + "<br>") ?//符號錯誤
? ? //頁面中彈出提示框
? ? function con() {
? ? ? ? var txt = confirm("請點擊我,準備好了嗎?");
? ? ? ? if (txt == true)
? ? ? ? { document.write("準備好了,起航吧!") }
? ? ? ? else {
? ? ? ? ? ? document.write("重新學習課程內容")
? ? ? ? }
? ? } ? ?//多余的
? ? //單行注釋
? ? // 我是單行注釋,我也要隱藏起來!
</script>
</head>
<body>
</body>
<input type="button" onclick="con()" value="請點擊我"> ? //兩個錯誤 ?
</input>
</html>
2016-04-27
<script type="text/javascript">
? ? //多行注釋
? ? /*我是多行注釋!
? ? 我需要隱藏,
? ? 否則會報錯哦!
? */
? ? //在頁面中顯示文字
? ? document.write("系好安全帶,準備起航。目標js" +?"<br>")?
? ? //頁面中彈出提示框
? ? function con() {
? ? ? ? var txt = confirm("請點擊我,準備好了嗎?");
? ? ? ? if (txt == true)
? ? ? ? { document.write("準備好了,起航吧!") }
? ? ? ? else {
? ? ? ? ? ? document.write("重新學習課程內容")
? ? ? ? }
? ??} ? ?//多余的(不多于,不要弄錯了,這個大括號是function的結束括號)
? ? //單行注釋
? ? // 我是單行注釋,我也要隱藏起來!
</script>
</head>
<body>
</body>
<input type="button" onclick="con()" value="請點擊我"> 這里input標簽要寫在body標簽內,而且不需要</input> 正確的寫法是<input type="button" onclick="con()" value="請點擊我"/>直接在最后加/
</input>
</html>
2016-04-27
con()
2016-04-23