web前端|html教程
Css实现tab标签效果(二)———-内容为动态的div
web前端-html教程
html代码:
蓝牙防丢器安卓源码,vscode宏替换,笔记本安装ubuntu,tomcat开发,sqlite 中文查询,精彩网页设计赏析,如何将数据库导入网站,邮箱服务器排名,织梦ping服务插件,框架前端项目框架搭建步骤,爬爬虫养殖,命名空间 php,滁州seo,springboot新闻,织梦批量修改tag标签,阅读分享网站源码,网页无边框,图片模板 网站源码,漂亮后台登陆,全屏滚动页面,租车管理系统java,svm分类器matlab程序lzw
View Code
猜歌游戏源码,vscode的插件的用法,ubuntu ppa仓库,tomcat版本信息查看,影视爬虫软件,php 自己写的模板引擎,湖南企业seo优化欢迎咨询,高端文化网站,学生选课系统html模板lzw
1 2 3 4567
16 17
18
19
20 21
dede field 源码,ubuntu系统动画,tomcat更换端口号,爬虫程序学习,php开发用什么编辑器,越秀区市场seo优化哪家便宜lzw
tab2.css代码:
View Code
1 ul li 2 { 3margin: 0px; 4padding: 0px; 5float: left; /*向左飘 */ 6background-color: White; 7list-style: none; /*隐藏li的小黑点*/ 8margin-left: 5px; 9color: blue;10cursor: pointer;11 }12 #content13 {14clear: both; /*因为使用了float:left效果 去除div的环绕*/15width: 400px;16height: 200px;17background-color: #f2f6fb;18border: 1px solid black;19position: relative;20top: -1px;21 }22 .tabin /*页面展现默认的li的样式*/23 {24border: black solid 1px;25background-color: white;26border-bottom: 0;27z-index: 100;28position: relative;29 }30 .divin /*页面展现默认的div样式*/31 {32display: block;33 }34 img35 {36display: none;37 }
tab2.js代码:
View Code
1 $(document).ready(function () { //页面加载完成后事件 2$("#realcontent").load("完整页面.htm"); 3$("li").each(function (index) { //循环每个li,index表示循环当前li的索引 4 $(this).click(function () { //为li注册点击事件 5 $("li.tabin").removeClass("tabin"); //获得li下class=tabin的li去除它的样式 6 $(this).addClass("tabin"); //为当前点击的li添加样式 7 if (index == 0) { 8 $("#realcontent").load("完整页面.htm"); //部署到iis 发送ajax请求 9 }10 else if (index == 1) {11 $("#realcontent").load("部分页面.aspx h2"); //发送ajax请求12 }13 else if (index == 2) {14 $("#realcontent").load("MoneyManagerWebService.asmx/HelloWorld"); //发送ajax请求 请求的是web服务15 }16 });17});18//为loading图片绑定ajax请求开始和结束事件19$("#content img").bind("ajaxStart", function () {20 $("#realcontent").html("");21 $(this).show();22}).bind("ajaxStop", function () {23 //$(this).hide();24 $(this).slideUp("1000");//延迟1秒隐藏25});26 })
完整页面.htm代码:
View Code
1 2 3 4 5
部分页面.aspx代码:
View Code
1 2 3 4 5 6
11 我是标题12
1314 171819 20
webservice服务代码:
View Code
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Web; 5 using System.Web.Services; 6 using System.Data; 7 using System.Data.SqlClient; 8 using System.Web.Script.Serialization; 9 10 11 /// 14 [WebService(Namespace = "/")]15 [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]16 //若要允许使用 AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。 17 [System.Web.Script.Services.ScriptService]18 public class MoneyManagerWebService : System.Web.Services.WebService19 {20 21public MoneyManagerWebService()22{23 24 //如果使用设计的组件,请取消注释以下行 25 //InitializeComponent(); 26}27 28[WebMethod]29public string HelloWorld()30{31 return "Hello World";32}33 }
效果图: