jQuery: Checking browser support
The jQuery Code START
<script type="text/javascript" src="./jquery-1.5.1.js"></script>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function() {
if($.support.boxModel) {
$('#first').html("I support the W3C box model.");
}
else {
$('#first').html("I do not support the W3C box model.");
}
if($.support.cssFloat) {
$('#second').html("I use style.cssFloat to access current CSS float value.");
}
else {
$('#second').html("I do not use style.cssFloat to access current CSS float value.");
}
if($.support.hrefNormalized) {
$('#third').html("I support hrefNormalized.");
}
else {
$('#third').html("I do not support hrefNormalized.");
}
if($.support.hrefSerialize) {
$('#fourth').html("I support proper link serialization when innerHTML is used.");
}
else {
$('#fourth').html("I do not support proper link serialization when innerHTML is used.");
}
if($.support.leadingWhitespace) {
$('#fifth').html("I preserve leading Whitespace with innerHTML.");
}
else {
$('#fifth').html("I do not preserve leading Whitespace with innerHTML.");
}
if($.support.noCloneEvent) {
$('#sixth').html("I do not clone event handlers.");
}
else {
$('#sixth').html("I do clone event handlers.");
}
});
</script>
<style type="text/CSS">
<!--
.code { color: red; }
.back { background-color: yellow; }
-->
</style>
</head>
<body>
<h1>jQuery: Checking browser support</h1>
<p id="first"></p>
<p id="second"></p>
<p id="third"></p>
<p id="fourth"></p>
<p id="fifth"></p>
<p id="sixth"></p>