本文实例为大家jQuery继承extend用法,供大家参考,具体内容如下
js代码
去除html标签,保留内容
$.htmlContent = function(tag){
var reTag = /<(?:.|\s)*?>/g;
return tag.replace(reTag,"");
}
//直接基于jQuery的扩展(方式二)
$.xy = {
sayhello:function(){return "hello";},saybaybay:function(){return "baybay";}
};
//jQuery类级别的扩展
$.extend({
add:function(a,b){return a+b;},diff:function(a,b){return a-b}
});
//jQuery对象级别的扩展
$.fn.extend({
getvalue:function(){
return this.val();
}
});
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
My JSP 'index.jsp' starting page
<Meta http-equiv="pragma" content="no-cache">
<Meta http-equiv="cache-control" content="no-cache">
<Meta http-equiv="expires" content="0">
<Meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<Meta http-equiv="description" content="This is my page">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<script type="text/javascript" src="jquery-1.7.js">
<script type="text/javascript" src="jquery-1.7.min.js">
<script type="text/javascript" src="my.js">
<script type="text/javascript">
$(function(){
var br = $("
");
$(".myspan").append(br);
})