samp
适用DTD:Strict Transitional Frameset 适用浏览器:All
释义
范例代码(sample)
语法
<samp 属性="属性值">~标签内容~</samp>
<samp 属性="属性值">~标签内容~</samp>
属性
属性 | 属性值 | 说明 |
---|---|---|
① 通用属性:id、class、title、style、dir、lang、xml:lang ![]() |
nbsp;
示范
<samp>范例代码</samp>
范例
下面的例子显示了XHTML文件基础结构:
运行
打印
下面的例子显示了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>
<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>