范例
下面的例子显示了XHTML文件基础结构:
运行打印
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>元素samp</title>
</head>
<body>
<p>
...
<script type="text/javascript">
var str = "This is a string.";
pos = str.indexOf("is");
alert(pos);
</script>
...
<samp>var str = "This is a string.";
pos = str.indexOf("is");
alert(pos);
</samp></p>
</body>
</html>