如何替换html中的doctype
How to replace doctype in html?
这是我的代码:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery Checkbox and Radio Button Styling</title>
<style type="text/css">
/*
* customRadioCheck: jQuery plugin for checkbox and radio replacement
* Usage: $('input[type=checkbox], input[type=radio]').customRadioCheck();
* Author: Cedric Ruiz
* License: MIT
*/
.custom-label {
display: inline-block;
margin-right: .8em;
cursor: pointer;
}
.custom-radio,
.custom-check {
vertical-align: middle;
display: inline-block;
position: relative;
top: -.15em; /* Adjust to for best fit */
margin: 0 .4em;
width: 20px;
height: 20px;
background: url(img/customRadioCheck.png) 0 0 no-repeat;
}
.custom-radio { background-position: 0 -20px; }
.custom-check.focus { background-position: -20px 0; }
.custom-radio.focus { background-position: -20px -20px; }
.custom-check.checked { background-position: -40px 0; }
.custom-radio.checked { background-position: -40px -20px; }
.custom-check.checked.focus { background-position: -60px 0; }
.custom-radio.checked.focus { background-position: -60px -20px; }
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
/*
* customRadioCheck: jQuery plguin for checkbox and radio replacement
* Usage: $('input[type=checkbox], input[type=radio]').customRadioCheck();
* Author: Cedric Ruiz
* License: MIT
*/
;(function(){
$.fn.customRadioCheck = function() {
return this.each(function() {
var $this = $(this);
var $span = $('<span/>');
$span.addClass('custom-'+ ($this.is(':checkbox') ? 'check' : 'radio'));
$this.is(':checked') && $span.addClass('checked'); // init
$span.insertAfter($this);
$this.parent('label').addClass('custom-label')
.attr('onclick', ''); // Fix clicking label in iOS
// hide by shifting left
$this.css({ position: 'absolute', left: '-9999px' });
// Events
$this.on({
change: function() {
if ($this.is(':radio')) {
$this.parent().siblings('label')
.find('.custom-radio').removeClass('checked');
}
$span.toggleClass('checked', $this.is(':checked'));
},
focus: function() { $span.addClass('focus'); },
blur: function() { $span.removeClass('focus'); }
});
});
};
}());
</script>
</head>
<body>
<a href='http://1stwebmagazine.com/jquery-checkbox-and-radio-button-styling'><img src='../img/logo.png' alt='1stWebMagazine' /></a>
<h1>jQuery Checkbox and Radio Button Styling</h1>
<div>
<h3>Checkbox:</h3>
<label><input type="checkbox"/>sfdf</label><br/>
<label><input type="checkbox"/>Lamb</label><br/>
<label><input type="checkbox"/>Tiger</label><br/>
</div>
<div>
<h3>Radio button:</h3>
<label><input type="radio" name="n"/>Green</label><br/>
<label><input type="radio" name="n"/>Blue</label><br/>
<label><input type="radio" name="n"/>Orange</label><br/>
</div>
<script type="text/javascript">
$('input[type=checkbox], input[type=radio]').customRadioCheck();
</script>
</body>
</html>
在上面的代码中,我使用了自定义的css复选框,但在我的jsp中,我不能使用标签
<!doctype html>
那么,有没有<!doctype html>
的替代方案,因为上面的代码没有它就无法工作
您仍然可以从JSP:声明HTML5 doctype
<![CDATA[<!DOCTYPE html>]]>
这里没有办法获得类似doctype的html对象。你可以做这个
document.write("<!doctype HTML>'n" + document.head.outerHTML + document.body.outerHTML);
使用新的doctype并替换完整的html源。
我会创建3个页面,一个HTML、CSS和JSP,并将它们链接在一起。
尝试使用此
<!DOCTYPE html SYSTEM "about:legacy-compat">
详细信息:http://www.totalvalidator.com/support/doctypes.html
相关文章:
- Dojo不解析自定义小部件的模板html中的小部件声明性
- 使用html中的外部javascript进行数据验证
- JS验证ajax返回的html中的表单数据
- 如何使用jquery更改html中的背景颜色
- Brightcove获取/显示HTML中的当前视频标题和描述
- 如何关闭html中的iframe弹出窗口
- 计算HTML中的页数
- 通过Javascript将HTML中的电话号码与URL参数进行交换
- 是否可以从html中的javascript调用.vbs文件
- HTML中的垂直进度条
- HTML 中的 Javascript 不会执行
- 使用CSS嵌入HTML中的水平居中jQuery
- 从JavaScript中正确返回html中的特殊字符
- 访问HTML中的data-*属性并将其作为道具传递
- 从.js文件调用html中的js函数
- JS/jquery:我将如何遍历HTML中的每个图像
- 对javascript使用.html中的select id
- 引用nodejs服务器中html中的java脚本文件
- 可以't在Wordpress中从HTML中的JS文件调用函数
- 从HTML中的外部JS文件调用函数