In the previous example we encountered a problem that some old browsers do not understand the <script> tag. These browsers will treat your JavaScript like HTML, so the page looks like this:
//put up an alert box, to show how they work alert("Soon, I will overthrow my browser!");
Congratulations
How bad this is! Fortunately, there is a solution in HTML comments:
<html>
<head>
<title> blah blah blah </title>
<script language="JavaScript">
<!-- hide this stuff from other browsers
Write your language here
// end the hiding comment -->
</script>
</head>
<body>
etc......
The working principle of this method has puzzled me for a long time, but you can use it without understanding it. If you don’t want to know, here is an introduction to you.
OK, believe it or not, you will prepare your first JavaScript exercise.
You are exhausted, aren’t you? Before you hang up, take a minute to read our first lesson review.
Previous page1234Read the full text