Link type 属性

Link 对象参考手册 Link 对象

定义和用法

type 属性可设置或者返回链接文档的类型(MIME 类型) 。

提示: MIME-types 实例: "text/css", "text/javascript", "image/gif", 等。

语法

设置 type 属性:

linkObject.type="MIME-type"

返回 type 属性:

linkObject.type


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要浏览器都支持 type 属性


实例

实例

显示链接文档的 MIME-type:

<html>
<head>
<link id="link1" rel="stylesheet" type="text/css" href="style1.css">
<script>
function displayResult()
{
var x=document.getElementById("link1").type;
alert(x);
}
</script>
</head>
<body>

<button type="button" onclick="displayResult()">Display MIME-type</button>

</body>
</html>

尝试一下 »


Link 对象参考手册 Link 对象