讯尔小白
2016-04-23 09:15
<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>
<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>
<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>
con()
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
//多行注释
/*我是多行注释!
我需要隐藏,
否则会报错哦!
*/
//在页面中显示文字
document.write("系好安全带,准备起航。目标js"+"<br>");
//页面中弹出提示框
function con(){
var txt=confirm("请点击我,准备好了吗?");
if(txt==true)
{document.write("准备好了,起航吧!")}
else{
document.write("重新学习课程内容")
}
}
//单行注释
// 我是单行注释,我也要隐藏起来!
</script>
</head>
<body>
<input type="button" onclick="con()" value="请点击我" />
</body>
</html>JavaScript进阶篇
469063 学习 · 22582 问题
相似问题