jQuery.support属性
jQuery.support属性包含一个属性集合,用来表示不同的浏览器功能或错误。
语法:
jQuery.support.propvalue
参数:此属性包含单个参数propvalue,这是必须的。它用于指定要测试的功能。包括的测试有。
- ajax
- boxModel
- changeBubbles
- checkClone
- checkOn
- cors
- cssFloat
- hrefNormalized
- htmlSerialize
- leadingWhitespace
- noCloneChecked
- noCloneEvent
- opacity
- optDisabled
- optSelected
- scriptEval()
- style
- submitBubbles
- tbody
示例1:这个例子使用jQuery.support属性来文本浏览器创建一个XMLHttpRequest对象。
<!DOCTYPE html>
<html>
<head>
<title>
jQuery jQuery.support property
</title>
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
</head>
<body>
<center>
<h1 style = "color:green;" >
GeeksForGeeks
</h1>
<h2> jQuery jQuery.support property</h2>
<h3 style="color:lightgreen;" ></h3>
<!-- Script to use jQuery.support property -->
<script>
(document).ready(function() {
("h3").html("GeeksForGeeks is best for"
+ " Computer Knowledge : "
+ jQuery.support.ajax);
});
</script>
</center>
</body>
</html>
输出:
例子2:这个例子说明了jQuery.support属性与cors参数值。
<!DOCTYPE html>
<html>
<head>
<title>
jQuery jQuery.support property
</title>
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
</head>
<body>
<center>
<h1 style = "color:green;" >
GeeksForGeeks
</h1>
<h2>jQuery jQuery.support property</h2>
<h3 style="color:lightgreen;" ></h3>
<!-- Script to use jQuery.support property -->
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script>
(document).ready(function() {
.support.cors = false;
$("h3").html(" Previous Example statement is not"
+ " correct : " + jQuery.support.cors);
});
</script>
</center>
</body>
</html>
输出: