Gridview.docx

上传人:b****5 文档编号:12369228 上传时间:2023-04-18 格式:DOCX 页数:58 大小:29.66KB
下载 相关 举报
Gridview.docx_第1页
第1页 / 共58页
Gridview.docx_第2页
第2页 / 共58页
Gridview.docx_第3页
第3页 / 共58页
Gridview.docx_第4页
第4页 / 共58页
Gridview.docx_第5页
第5页 / 共58页
点击查看更多>>
下载资源
资源描述

Gridview.docx

《Gridview.docx》由会员分享,可在线阅读,更多相关《Gridview.docx(58页珍藏版)》请在冰豆网上搜索。

Gridview.docx

Gridview

可以在Gridview的RowDataBound事件中实现代码

1.

2.protectedvoidGridView1_RowDataBound(objectsender,GridViewRowEventArgse)

3.{

4.if(e.Row.RowType==DataControlRowType.DataRow)

5.{

6.foreach(TableCellcelline.Row.Cells)

7.{

8.//单击鼠标可以将单元格中的内容复制到剪切板

9.cell.Attributes.Add("onclick","window.clipboardData.setData('Text',this.innerText);");

10.//鼠标移入可以设置单元格字体颜色

11.cell.Attributes.Add("onmouseover","this.style.color='red'");

12.//鼠标移开,取消单元格字体颜色设置

13.cell.Attributes.Add("onmouseout","this.style.color=''");

14.

15.}

16.}

17.}

GridView控件实现支持分页的自动编号代码

错误只有本页编号的写法

TemplateFieldHeaderText="序号">

<%#Container.DataItemIndex+1%>

TemplateField>

 

正确的如下(参考其它人的忘了地址保存文本)

 

前台

 

TemplateFieldHeaderText="序号">

<%#(this.Pager.CurrentPageIndex-1)*this.Pager.PageSize+Container.DataItemIndex+1%>

TemplateField>

 

后台

在RowDataBound事件中加

 

if(e.Row.RowIndex>-1)

{

e.Row.Cells[0].Text=Convert.ToString((this.Pager.CurrentPageIndex-1)*this.Pager.PageSize+e.Row.RowIndex+1);

}

 

这就OK了,前台,后台只用一个即可,Pager是用的分页控件,这种分页控件都是从1开始,所以要进行减一的操作,如果用PagedDataSourceps=newPagedDataSource();ps.CurrentPageIndex 就不用进行减一,因为他是从0开始相加的。

GridView加入自动求和求平均值小计

GridView加入自动求和求平均值小计

效果图:

 

解决方案:

 

1privatedoublesum=0;//取指定列的数据和,你要根据具体情况对待可能你要处理的是int

2protectedvoidGridView1_RowDataBound(objectsender,GridViewRowEventArgse)

3{

4if(e.Row.RowIndex>=0)

5{

6sum+=Convert.ToDouble(e.Row.Cells[6].Text);

7}

8elseif(e.Row.RowType==DataControlRowType.Footer)

9{

10e.Row.Cells[5].Text="总薪水为:

";

11e.Row.Cells[6].Text=sum.ToString();

12e.Row.Cells[3].Text="平均薪水为:

";

13e.Row.Cells[4].Text=((int)(sum/GridView1.Rows.Count)).ToString();

14}

15}

后台全部代码:

 

1usingSystem;

2usingSystem.Data;

3usingSystem.Configuration;

4usingSystem.Web;

5usingSystem.Web.Security;

6usingSystem.Web.UI;

7usingSystem.Web.UI.WebControls;

8usingSystem.Web.UI.WebControls.WebParts;

9usingSystem.Web.UI.HtmlControls;

10usingSystem.Data.SqlClient;

11usingSystem.Drawing;

12publicpartialclassDefault7:

System.Web.UI.Page

13{

14SqlConnectionsqlcon;

15SqlCommandsqlcom;

16stringstrCon="DataSource=(local);Database=北风贸易;Uid=sa;Pwd=sa";

17protectedvoidPage_Load(objectsender,EventArgse)

18{

19if(!

IsPostBack)

20{

21bind();

22}

23}

24protectedvoidGridView1_RowEditing(objectsender,GridViewEditEventArgse)

25{

26GridView1.EditIndex=e.NewEditIndex;

27bind();

28}

29protectedvoidGridView1_RowUpdating(objectsender,GridViewUpdateEventArgse)

30{

31sqlcon=newSqlConnection(strCon);

32stringsqlstr="update飞狐工作室set姓名='"

33+((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim()+"',家庭住址='"

34+((TextBox)(GridView1.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim()+"'where身份证号码='"

35+GridView1.DataKeys[e.RowIndex].Value.ToString()+"'";

36sqlcom=newSqlCommand(sqlstr,sqlcon);

37sqlcon.Open();

38sqlcom.ExecuteNonQuery();

39sqlcon.Close();

40GridView1.EditIndex=-1;

41bind();

42}

43protectedvoidGridView1_RowCancelingEdit(objectsender,GridViewCancelEditEventArgse)

44{

45GridView1.EditIndex=-1;

46bind();

47}

48publicvoidbind()

49{

50stringsqlstr="selecttop5*from飞狐工作室";

51sqlcon=newSqlConnection(strCon);

52SqlDataAdaptermyda=newSqlDataAdapter(sqlstr,sqlcon);

53DataSetmyds=newDataSet();

54sqlcon.Open();

55myda.Fill(myds,"飞狐工作室");

56GridView1.DataSource=myds;

57GridView1.DataKeyNames=newstring[]{"身份证号码"};

58GridView1.DataBind();

59sqlcon.Close();

60}

61privatedoublesum=0;//取指定列的数据和

62protectedvoidGridView1_RowDataBound(objectsender,GridViewRowEventArgse)

63{

64if(e.Row.RowIndex>=0)

65{

66sum+=Convert.ToDouble(e.Row.Cells[6].Text);

67}

68elseif(e.Row.RowType==DataControlRowType.Footer)

69{

70e.Row.Cells[5].Text="总薪水为:

";

71e.Row.Cells[6].Text=sum.ToString();

72e.Row.Cells[3].Text="平均薪水为:

";

73e.Row.Cells[4].Text=((int)(sum/GridView1.Rows.Count)).ToString();

74}

75}

76}

前台:

唯一的花头就是设置ShowFooter="True",否则默认表头为隐藏的!

 

1

GridViewID="GridView1"runat="server"AutoGenerateColumns="False"CellPadding="3"OnRowEditing="GridView1_RowEditing"

2OnRowUpdating="GridView1_RowUpdating"OnRowCancelingEdit="GridView1_RowCancelingEdit"BackColor="White"BorderColor="#CCCCCC"BorderStyle="None"BorderWidth="1px"Font-Size="12px"OnRowDataBound="GridView1_RowDataBound"ShowFooter="True">

3

4

5

CommandFieldHeaderText="编辑"ShowEditButton="True"/>

6

BoundFieldDataField="身份证号码"HeaderText="编号"ReadOnly="True"/>

7

BoundFieldDataField="姓名"HeaderText="姓名"/>

8

BoundFieldDataField="出生日期"HeaderText="邮政编码"/>

9

BoundFieldDataField="家庭住址"HeaderText="家庭住址"/>

10

BoundFieldDataField="邮政编码"HeaderText="邮政编码"/>

11

BoundFieldDataField="起薪"HeaderText="起薪"/>

12

13

14

15

16

17

18

GridView>

 

GridView合并表头多重表头(以合并3列3行举例)

GridView合并表头多重表头无错完美版(以合并3列3行举例)

效果图:

 

后台代码:

 

1usingSystem;

2usingSystem.Data;

3usingSystem.Configuration;

4usingSystem.Web;

5usingSystem.Web.Security;

6usingSystem.Web.UI;

7usingSystem.Web.UI.WebControls;

8usingSystem.Web.UI.WebControls.WebParts;

9usingSystem.Web.UI.HtmlControls;

10usingSystem.Data.SqlClient;

11usingSystem.Drawing;

12publicpartialclass_Default:

System.Web.UI.Page

13{

14SqlConnectionsqlcon;

15SqlCommandsqlcom;

16stringstrCon="DataSource=(local);Database=北风贸易;Uid=sa;Pwd=sa";

17protectedvoidPage_Load(objectsender,EventArgse)

18{

19if(!

IsPostBack)

20{

21bind();

22

23}

24}

25protectedvoidGridView1_RowEditing(objectsender,GridViewEditEventArgse)

26{

27GridView1.EditIndex=e.NewEditIndex;

28bind();

29}

30protectedvoidGridView1_RowUpdating(objectsender,GridViewUpdateEventArgse)

31{

32sqlcon=newSqlConnection(strCon);

33stringsqlstr="update飞狐工作室set姓名='"

34+((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim()+"',家庭住址='"

35+((TextBox)(GridView1.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim()+"'where身份证号码='"

36+GridView1.DataKeys[e.RowIndex].Value.ToString()+"'";

37sqlcom=newSqlCommand(sqlstr,sqlcon);

38sqlcon.Open();

39sqlcom.ExecuteNonQuery();

40sqlcon.Close();

41GridView1.EditIndex=-1;

42bind();

43}

44protectedvoidGridView1_RowCancelingEdit(objectsender,GridViewCancelEditEventArgse)

45{

46GridView1.EditIndex=-1;

47bind();

48}

49publicvoidbind()

50{

51stringsqlstr="selecttop10*from飞狐工作室";

52sqlcon=newSqlConnection(strCon);

53SqlDataAdaptermyda=newSqlDataAdapter(sqlstr,sqlcon);

54DataSetmyds=newDataSet();

55sqlcon.Open();

56myda.Fill(myds,"飞狐工作室");

57GridView1.DataSource=myds;

58GridView1.DataKeyNames=newstring[]{"身份证号码"};

59GridView1.DataBind();

60sqlcon.Close();

61}

62

63//这里就是解决方案

64protectedvoidGridView1_RowCreated(objectsender,GridViewRowEventArgse)

65{

66switch(e.Row.RowType)

67{

68caseDataControlRowType.Header:

69//第一行表头

70TableCellCollectiontcHeader=e.Row.Cells;

71tcHeader.Clear();

72tcHeader.Add(newTableHeaderCell());

73tcHeader[0].Attributes.Add("rowspan","3");//跨Row

74tcHeader[0].Attributes.Add("bgcolor","white");

75tcHeader[0].Text="";

76tcHeader.Add(newTableHeaderCell());

77//tcHeader[1].Attributes.Add("bgcolor","Red");

78tcHeader[1].Attributes.Add("colspan","6");//跨Column

79tcHeader[1].Text="全部信息";

80

81//第二行表头

82tcHeader.Add(newTableHeaderCell());

83tcHeader[2].Attributes.Add("bgcolor","DarkSeaGreen");

84tcHeader[2].Text="身份证号码";

85tcHeader.Add(newTableHeaderCell());

86tcHeader[3].Attributes.Add("bgcolor","LightSteelBlue");

87tcHeader[3].Attributes.Add("colspan","2");

88tcHeader[3].Text="基本信息";

89tcHeader.Add(newTableHeaderCell());

90tcHeader[4].Attributes.Add("bgcolor","DarkSeaGreen");

91tcHeader[4].Text="福利";

92tcHeader.Add(newTableHeaderCell());

93tcHeader[5].Attributes.Add("bgcolor","LightSteelBlue");

94tcHeader[5].Attributes.Add("colspan","2");

95tcHeader[5].Text="联系方式";

96

97//第三行表头

98tcHeader.Add(newTableHeaderCell());

99tcHeader[6].Attributes.Add("bgcolor","Khaki");

100tcHeader[6].Text="身份证号码";

101tcHeader.Add(newTableHeaderCell());

102tcHeader[7].Attributes.Add("bgcolor","Khaki");

103tcHeader[7].Text="姓名";

104tcHeader.Add(newTableHeaderCell());

105tcHeader[8].Attributes.Add("bgcolor","Khaki");

106tcHeader[8].Text="出生日期";

107tcHeader.Add(newTableHeaderCell());

108tcHeader[9].Attributes.Add("bgcolor","Khaki");

109tcHeader[9].Text="薪水";

110tcHeader.Add(newTableHeaderCell());

111tcHeader[10].Attributes.Add("bgcolor","Khaki");

112tcHeader[10].Text="家庭住址";

113tcHeader.Add(newTableHeaderCell());

114tcHeader[11].Attributes.Add("bgcolor","Khaki");

115tcHeader[11].Text="邮政编码";

116break;

117}

118}

119}

前台:

 

1

DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http:

//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

2

3

//www.w3.org/1999/xhtml">

4

5GridView合并多重表头表头清清月儿ht</p> </div> <div class="readmore" onclick="showmore()" style="background-color:transparent; height:auto; margin:0px 0px; padding:20px 0px 0px 0px;"><span class="btn-readmore" style="background-color:transparent;"><em style=" font-style:normal">展开</em>阅读全文<i></i></span></div> <script> function showmore() { $(".readmore").hide(); $(".detail-article").css({ "height":"auto", "overflow": "hidden" }); } $(document).ready(function() { var dh = $(".detail-article").height(); if(dh >100) { $(".detail-article").css({ "height":"100px", "overflow": "hidden" }); } else { $(".readmore").hide(); } }); </script> </div> <script> var defaultShowPage = parseInt("5"); var id = "12369228"; var total_page = "58"; var mfull = false; var mshow = false; function DownLoad() { window.location.href='https://m.bdocx.com/down/12369228.html'; } function relate() { var reltop = $('#relate').offset().top-50; $("html,body").animate({ scrollTop: reltop }, 500); } </script> <script> var pre = "https://file1.bdocx.com/fileroot1/2023-4/18/27d07216-95c1-4e7a-a1c7-edd81b5ec7de/27d07216-95c1-4e7a-a1c7-edd81b5ec7de"; var freepage = parseInt('20'); var total_c = parseInt('58'); var start = defaultShowPage; var adcount = 0; var adindex = 0; var adType_list = ";0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;"; var end = start; function ShowSvg() { end = start + defaultShowPage; if (end > freepage) end = freepage; for (var i = start; i < end; i++) { var imgurl = pre + (i + 1) + '.gif'; var html = "<img src='" + imgurl + "' onerror=\"this.src='/images/s.gif'\" alt=\"Gridview.docx_第" + (i + 1) + "页\" width='100%'/>"; $("#page").append("<div class='page'>" + html + "</div>"); $("#page").append("<div class='pageSize'>第" + (i + 1) + "页 / 共" + total_c + "页</div>"); if(adcount > 0 && adType_list.indexOf(";"+(i+1)+";")>-1) { if(adindex > (adcount-1)) adindex = 0; $("#page").append("<div class='pagead' id='addiv"+(i + 1)+"'></div>"); document.getElementById("addiv"+(i + 1)+"").innerHTML =document.getElementById("adpre" + adindex).outerHTML; adindex += 1; } } start = end; if (start > (freepage - 1)) { if (start < total_c) { $("#pageMore").removeClass("btnmore"); $("#pageMore").html("亲,该文档总共" + total_c + "页,到这儿已超出免费预览范围,如果喜欢就下载吧!"); } else { $("#pageMore").removeClass("btnmore"); $("#pageMore").html("亲,该文档总共" + total_c + "页全部预览完了,如果喜欢就下载吧!"); } } } //$(document).ready(function () { // ShowSvg(); //}); </script> <div id="relate" class="container" style="padding:0px 0px 15px 0px; margin-top:20px; border:solid 1px #dceef8"> <div style=" font-size: 16px; background-color:#e5f0f7; margin-bottom:5px; font-weight: bold; text-indent:10px; line-height: 40px; height:40px; padding-bottom: 0px;">相关资源</div> <div id="relatelist" style="padding-left:5px;"> <ul> <li><em class="docx"/></em><a target="_parent" href="https://m.bdocx.com/doc/30873263.html" title="一区地下车库计算书.docx">一区地下车库计算书.docx</a> </li><li><em class="doc"/></em><a target="_parent" href="https://m.bdocx.com/doc/30873038.html" title="智能洗衣机控制系统设计.doc">智能洗衣机控制系统设计.doc</a> </li><li><em class="doc"/></em><a target="_parent" href="https://m.bdocx.com/doc/30872977.html" title="公司财务管理规章制度.doc">公司财务管理规章制度.doc</a> </li><li><em class="doc"/></em><a target="_parent" href="https://m.bdocx.com/doc/30872967.html" title="备份方案.doc">备份方案.doc</a> </li><li><em class="doc"/></em><a target="_parent" href="https://m.bdocx.com/doc/30872875.html" title="自然辩证法(研究生课程).doc">自然辩证法(研究生课程).doc</a> </li><li><em class="xls"/></em><a target="_parent" href="https://m.bdocx.com/doc/30872806.html" title="高密度沉淀池计算书 (1).xls">高密度沉淀池计算书 (1).xls</a> </li><li><em class="docx"/></em><a target="_parent" href="https://m.bdocx.com/doc/30872767.html" title="我办职业教育活动周征文范文3篇.docx">我办职业教育活动周征文范文3篇.docx</a> </li><li><em class="pdf"/></em><a target="_parent" href="https://m.bdocx.com/doc/30872252.html" title="全国公路工程建设造价指标与劳务分包指导价.pdf">全国公路工程建设造价指标与劳务分包指导价.pdf</a> </li><li><em class="ppt"/></em><a target="_parent" href="https://m.bdocx.com/doc/30871908.html" title="就业方面】大学生就业指导(高职高专版).ppt">就业方面】大学生就业指导(高职高专版).ppt</a> </li><li><em class="pptx"/></em><a target="_parent" href="https://m.bdocx.com/doc/30871885.html" title="椎间孔镜围手术期护理ppt.pptx">椎间孔镜围手术期护理ppt.pptx</a> </li> </ul> </div> </div> <div class="container" style="padding:0px 0px 15px 0px; margin-top:20px; border:solid 1px #dceef8"> <div style=" font-size: 16px; background-color:#e5f0f7; margin-bottom:5px; font-weight: bold; text-indent:10px; line-height: 40px; height:40px; padding-bottom: 0px;">猜你喜欢</div> <div id="relatelist" style="padding-left:5px;"> <ul> <li><em class="docx"></em> <a href="https://m.bdocx.com/doc/12310300.html" target="_parent" title="中学生运动会开幕式解说词大全.docx">中学生运动会开幕式解说词大全.docx</a></li> <li><em class="docx"></em> <a href="https://m.bdocx.com/doc/12310301.html" target="_parent" title="一村一品展销中心可行性研究报告.docx">一村一品展销中心可行性研究报告.docx</a></li> <li><em class="docx"></em> <a href="https://m.bdocx.com/doc/12310302.html" target="_parent" title="图文人教版小学数学二年级上册期末考试精选5.docx">图文人教版小学数学二年级上册期末考试精选5.docx</a></li> <li><em class="docx"></em> <a href="https://m.bdocx.com/doc/12310303.html" target="_parent" title="雪域豹影读后感.docx">雪域豹影读后感.docx</a></li> <li><em class="docx"></em> <a href="https://m.bdocx.com/doc/12310304.html" target="_parent" title="中职语文教学工作计划范文.docx">中职语文教学工作计划范文.docx</a></li> <li><em class="docx"></em> <a href="https://m.bdocx.com/doc/12310305.html" target="_parent" title="异地调岗申请书范文精选多篇.docx">异地调岗申请书范文精选多篇.docx</a></li> <li><em class="docx"></em> <a href="https://m.bdocx.com/doc/12310306.html" target="_parent" title="外研版小学新标准英语三年级起第三册全册教案.docx">外研版小学新标准英语三年级起第三册全册教案.docx</a></li> <li><em class="docx"></em> <a href="https://m.bdocx.com/doc/12310307.html" target="_parent" title="业计划书是一份全方位的商业计划.docx">业计划书是一份全方位的商业计划.docx</a></li> <li><em class="docx"></em> <a href="https://m.bdocx.com/doc/12310308.html" target="_parent" title="银行笔试内容.docx">银行笔试内容.docx</a></li> </ul> </div> </div> <div style=" font-size: 16px; background-color:#e5f0f7; margin-top:20px; font-weight: bold; text-indent:10px; line-height: 40px; height:40px; padding-bottom: 0px; margin-bottom:10px;"> 相关搜索</div> <div class="widget-box pt0" style="border: none; padding:0px 5px;"> <ul class="taglist--inline multi"> <li class="tagPopup"><a target="_parent" class="tag tagsearch" rel="nofollow" href="https://m.bdocx.com/search.html?q=Gridview">Gridview</a></li> </ul> </div> <br /> <div > 当前位置:<a target="_parent" href="https://m.bdocx.com/">首页</a> > <a href="https://m.bdocx.com/booklist-00022.html">外语学习</a><span> > </span><a href="https://m.bdocx.com/booklist-0002200004.html">日语学习</a> </div> <br /> <div class="cssnone"> <iframe title="来源" src="https://m.bdocx.com/BookRead.aspx?id=PZ3FFaHVEMzyOHdOuJhD%7cg%3d%3d&parto=rp0CbJC7Lfr%2fyRhFEnWViWP4uD4xnjVFMsdHifzbtYKdoR6504IQTmzapNcN8%2f4qfmwZa2tqnrZSzXLkfW7lQGSIv8NwCgDaxr8ujZFXXlEv2D8Lba34mRPnZXtMKogI8KBqkAOruJ%2bIOIkLujHTRkWhf77Iej%2fwzI6EM7DxQ7XCH4vitXcqtmXwcng975ZQWNDcCewkzavKnQf3bZmvZXa3aFX1fmNw" frameborder="0" style="width: 0px; height: 0px"> </iframe> </div> <span id="LabelScript"></span> <script src="https://mstatic.bdocx.com/JS/bootstrap-collapse.js"></script> </form> <div class="siteInner_bg" style="margin-top: 40px; border: solid 0px red; margin-left: 0px; margin-right: 0px;"> <div class="siteInner"> <p style="text-align: center;">copyright@ 2008-2022 冰豆网网站版权所有</p><p style="text-align: center;">经营许可证编号:<a href="http://beian.miit.gov.cn/" target="_blank">鄂ICP备2022015515号-1</a></p><script>var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?2e77bd3f6fe91b0e21d3f22267249ee3"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();</script><script>(function(){ var el = document.createElement("script"); el.src = "https://lf1-cdn-tos.bytegoofy.com/goofy/ttzz/push.js?81476e42bf626128cf29544ee216a8ed7deb9487dce7ed62313212129c4244a219d1c501ebd3301f5e2290626f5b53d078c8250527fa0dfd9783a026ff3cf719"; el.id = "ttzz"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(el, s); })(window)</script> </div> </div> <div class="trnav clearfix" id="navcontent" style="display: none; background-color:#3a71b1; "> <div class="trlogoside" id="navlogo" style="display: none;"> <a href="https://m.bdocx.com/" title="冰豆网"><img src="https://www.bdocx.com/images/logo_bd.png" alt="冰豆网"></a> <div class="trnavclose" id="navclose"> <span></span> </div> </div> <div class="navcontainer"> <div class="row"> <ul class="nav navbar-nav trnavul headercontent" id="navigation" style="margin:20px 0 0px;"> <li><a target="_parent"href="https://m.bdocx.com/login.aspx">登录</a></li> <li><a target="_parent"href="https://m.bdocx.com/">首页 </a></li> <li><a target="_parent"href="https://m.bdocx.com/booklist-0.html">资源分类 </a></li> <li><a target="_parent"href="https://m.bdocx.com/UserManage/Recharge.aspx?f=0"><img src="https://m.bdocx.com/images/s.gif" alt="new" class="hottip1">升级会员 <img src="https://www.bdocx.com/FileUpload/Images/48520fea-bc98-41ae-b183-84689c7075c9.gif" alt="new" class="hottip"></a></li> <li><a target="_parent"href="https://m.bdocx.com/newslist.html">通知公告 </a></li> <li><a target="_parent"href="https://m.bdocx.com/h-0.html">帮助中心 </a></li> </ul> </div> </div> </div> <script type="text/javascript"> function stopPropagation(e) { var ev = e || window.event; if (ev.stopPropagation) { ev.stopPropagation(); } else if (window.event) { window.event.cancelBubble = true;//兼容IE } } $("#navmore").click(function (e) { $("#navcontent").show(); $("#navlogo").show(); stopPropagation(e); var navcontentwidth = $("#navcontent").width(); $('#navcontent').css({ 'right': '-' + navcontentwidth + 'px' }); $("#navcontent").show().animate({ "right": 0 }, 300); }); $(document).bind('click', function () { var navcontentwidth = $("#navcontent").width(); $("#navcontent").animate({ 'right': '-' + navcontentwidth + 'px' }, 300, function () { $("#navcontent").hide(); }); $("#navlogo").fadeOut(300); }); $("#navcontent").click(function (e) { stopPropagation(e); }); $("#navclose").click(function (e) { var navcontentwidth = $("#navcontent").width(); $("#navcontent").animate({ 'right': '-' + navcontentwidth + 'px' }, 300, function () { $("#navcontent").hide(); }); $("#navlogo").fadeOut(300); }); </script> <script> function BaseShare(title, desc, imgUrl) { var link = "https://m.bdocx.com/doc/12369228.html"; if (wx) { wx.config({ debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 appId: 'wx4f717640abfd1120', // 必填,公众号的唯一标识 timestamp: '1728634676', // 必填,生成签名的时间戳 nonceStr: '8B6DD7DB9AF49E67306FEB59A8BDC52C', // 必填,生成签名的随机串 signature: '315a7097ee8c30b69fc196824d602dcbd86c27ad',// 必填,签名,见附录1 jsApiList: ['onMenuShareAppMessage', 'onMenuShareTimeline', 'updateAppMessageShareData', 'updateTimelineShareData', 'hideMenuItems'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2 //openTagList: ["wx-open-launch-weapp"]//H5打开小程序 }); wx.ready(function () { //需在用户可能点击分享按钮前就先调用 wx.hideMenuItems({// 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3 menuList: ['menuItem:share:qq', 'menuItem:favorite', 'menuItem:share:QZone', 'menuItem:share:email', 'menuItem:originPage', 'menuItem:readMode', 'menuItem:delete', 'menuItem:editTag', 'menuItem:share:facebook', 'menuItem:share:weiboApp', 'menuItem:share:brand'] }); var shareData = { title: title, // 分享标题 desc: desc,//这里请特别注意是要去除html link: link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 imgUrl: imgUrl, // 分享图标 }; wx.updateAppMessageShareData(shareData);//1.4 分享到朋友 wx.updateTimelineShareData(shareData);//1.4分享到朋友圈 }); } } function BaseShare(title, desc, imgUrl, link) { if (link=="") link = "https://m.bdocx.com/doc/12369228.html"; if (wx) { wx.config({ debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 appId: 'wx4f717640abfd1120', // 必填,公众号的唯一标识 timestamp: '1728634676', // 必填,生成签名的时间戳 nonceStr: '8B6DD7DB9AF49E67306FEB59A8BDC52C', // 必填,生成签名的随机串 signature: '315a7097ee8c30b69fc196824d602dcbd86c27ad',// 必填,签名,见附录1 jsApiList: ['onMenuShareAppMessage', 'onMenuShareTimeline', 'updateAppMessageShareData', 'updateTimelineShareData', 'hideMenuItems'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2 //openTagList: ["wx-open-launch-weapp"]//H5打开小程序 }); wx.ready(function () { //需在用户可能点击分享按钮前就先调用 wx.hideMenuItems({// 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3 menuList: ['menuItem:share:qq', 'menuItem:favorite', 'menuItem:share:QZone', 'menuItem:share:email', 'menuItem:originPage', 'menuItem:readMode', 'menuItem:delete', 'menuItem:editTag', 'menuItem:share:facebook', 'menuItem:share:weiboApp', 'menuItem:share:brand'] }); var shareData = { title: title, // 分享标题 desc: desc,//这里请特别注意是要去除html link: link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 imgUrl: imgUrl, // 分享图标 }; wx.updateAppMessageShareData(shareData);//1.4 分享到朋友 wx.updateTimelineShareData(shareData);//1.4分享到朋友圈 }); } } </script> <script> $(document).ready(function () { var arr = $(".headercontent"); for (var i = 0; i < arr.length; i++) { (function (index) { var url = "https://m.bdocx.com/header.aspx"; $.get(url + "?t=" + (new Date()).valueOf(), function (d) { try { arr.eq(index).empty().html(d); } catch (e) { } try { arr.html(d); } catch (e) { } }); })(i); } }); </script> <script src="https://mstatic.bdocx.com/js/jquery.lazyload.js"></script> <script charset="utf-8"> $("img.lazys").lazyload({ threshold: 200, effect: "fadeIn" }); </script> </body> </html>