Link type 屬性

定義和用法
type 屬性可設(shè)置或者返回鏈接文檔的類(lèi)型(MIME 類(lèi)型) 。
提示: MIME-types 實(shí)例: "text/css", "text/javascript", "image/gif", 等。
語(yǔ)法
設(shè)置 type 屬性:
linkObject.type="MIME-type"
返回 type 屬性:
linkObject.type
瀏覽器支持
所有主要瀏覽器都支持 type 屬性
實(shí)例
實(shí)例
顯示鏈接文檔的 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>
<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>
嘗試一下 ?

更多建議: