当前位置: 编程技术>WEB前端
本页文章导读:
▪C# 获取网页html源文件 /// <summary>
/// 获取网页html源文件
/// </summary>
/// <param name="url">网页地址</param>
/// <param name="encodingStr">网页文件编码字符串</param&.........
▪【javascript】tabs选项卡切换效果(扩展版) 前段时间写了个 tabs 选项卡切换效果,今天抽空在原有的基础上进行了扩展,加入了自动轮播,这样就变成了类似图片轮播的效果了。html 代码:<!DOCTYPE HTML><html lang="en-US"><head&g.........
▪JS实现日期加减 JS实现日期加减:效果:成型日期-龄期=要求试验日期!事件:当改变成型日期文本框后触发事件!当改变龄期文本框后触发事件!代码: 1 (说明:成型日期ID: tbcxrq 龄期ID: tblq 要求试.........
[1]C# 获取网页html源文件
来源: 互联网 发布时间: 2013-11-06
/// <summary> /// 获取网页html源文件 /// </summary> /// <param name="url">网页地址</param> /// <param name="encodingStr">网页文件编码字符串</param> /// <returns>html源文件</returns> #region GetPageSource public static string GetPageSource(string url, string encodingStr) { HttpWebResponse res = null; string strResult = ""; try { HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); //req.Method = "POST"; req.KeepAlive = true; req.ContentType = "application/x-www-form-urlencoded"; req.Accept = "text/Html,application/xhtml+XML,application/xml;q=0.9,*/*;q=0.8"; req.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.2; zh-CN; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8"; res = (HttpWebResponse)req.GetResponse(); StreamReader reader = new StreamReader(res.GetResponseStream(), Encoding.GetEncoding(encodingStr)); strResult = reader.ReadToEnd(); reader.Close(); } catch { } finally { if (res != null) { res.Close(); } } return strResult; }
作者:vaecnfeilong 发表于2013-1-11 18:16:24 原文链接
阅读:0 评论:0 查看评论
[2]【javascript】tabs选项卡切换效果(扩展版)
前段时间写了个 tabs 选项卡切换效果,今天抽空在原有的基础上进行了扩展,加入了自动轮播,这样就变成了类似图片轮播的效果了。
html 代码:
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>js-tabs</title>
<link rel="stylesheet" type="text/css" href="/blog_article/css/base.css" media="all"/>
<style type="text/css">
a{color:#a0b3d6;}
.tabs{border:1px solid #a0b3d6;margin:100px;width:300px;}
.tabs-nav a{background:#eaf0fd;line-height:30px;padding:0 20px;display:inline-block;border-right:1px solid #a0b3d6;border-bottom:1px solid #a0b3d6;float:left;}
.tabs-nav .on{background:white;border-bottom:1px solid white;_position:relative;}
.tabs-content{padding:20px;border-top:1px solid #a0b3d6;margin-top:-1px;}
</style>
</head>
<body>
<div id="tabs">
<h2 >
<a href="javascript:;" >首页</a>
<a href="javascript:;">技术</a>
<a href="javascript:;">生活</a>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>js-tabs</title>
<link rel="stylesheet" type="text/css" href="/blog_article/css/base.css" media="all"/>
<style type="text/css">
a{color:#a0b3d6;}
.tabs{border:1px solid #a0b3d6;margin:100px;width:300px;}
.tabs-nav a{background:#eaf0fd;line-height:30px;padding:0 20px;display:inline-block;border-right:1px solid #a0b3d6;border-bottom:1px solid #a0b3d6;float:left;}
.tabs-nav .on{background:white;border-bottom:1px solid white;_position:relative;}
.tabs-content{padding:20px;border-top:1px solid #a0b3d6;margin-top:-1px;}
</style>
</head>
<body>
<div id="tabs">
<h2 >
<a href="javascript:;" >首页</a>
<a href="javascript:;">技术</a>
<a href="javascript:;">生活</a>
[3]JS实现日期加减
JS实现日期加减:
效果:成型日期-龄期=要求试验日期!
事件:
代码:
1 (说明:成型日期ID: tbcxrq 龄期ID: tblq 要求试验日期ID: tbyqsyrq)
2 <script type="text/javascript">
3
4 $(function() {
5 $("#<%=tbcxrq.ClientID %>").change(function() { CaclDate(); });
6 $("#<%=tblq.ClientID %>").change(function() { CaclDate(); });
7 //根据龄期计算试验时间
8 function CaclDate() {
9
10 if ($("#<%=tblq.ClientID %>").val() == "" || $("#<%=tbcxrq.ClientID %>").val() == "") {
11 $("#<%=tbyqsyrq.ClientID %>").val("");
12 }
13 else {
14 var MoldingDate = $("#<%=tbcxrq.ClientID %>").val();
15 MoldingDate = MoldingDate.replace("-", "/")
16 var d = new Date(MoldingDate);
17 var AgeDate = $("#<%=tblq.ClientID %>").val();
18 d.setDate(d.getDate() + parseInt(AgeDate));
19 var month = d.getMonth() + 1;
20 if (parseInt(month) < 10)
21 month = "0" + month;
22 var day = d.getDate();
23 if (parseInt(day) < 10)
24 day = "0" + day;
25
26 var date = (d.getFullYear()) + "-" + month + "-" + day;
27 $("#<%=tbyqsyrq.ClientID %>").val(date);
28 }
29 }
30 });
31 </script>
2 <script type="text/javascript">
3
4 $(function() {
5 $("#<%=tbcxrq.ClientID %>").change(function() { CaclDate(); });
6 $("#<%=tblq.ClientID %>").change(function() { CaclDate(); });
7 //根据龄期计算试验时间
8 function CaclDate() {
9
10 if ($("#<%=tblq.ClientID %>").val() == "" || $("#<%=tbcxrq.ClientID %>").val() == "") {
11 $("#<%=tbyqsyrq.ClientID %>").val("");
12 }
13 else {
14 var MoldingDate = $("#<%=tbcxrq.ClientID %>").val();
15 MoldingDate = MoldingDate.replace("-", "/")
16 var d = new Date(MoldingDate);
17 var AgeDate = $("#<%=tblq.ClientID %>").val();
18 d.setDate(d.getDate() + parseInt(AgeDate));
19 var month = d.getMonth() + 1;
20 if (parseInt(month) < 10)
21 month = "0" + month;
22 var day = d.getDate();
23 if (parseInt(day) < 10)
24 day = "0" + day;
25
26 var date = (d.getFullYear()) + "-" + month + "-" + day;
27 $("#<%=tbyqsyrq.ClientID %>").val(date);
28 }
29 }
30 });
31 </script>
本文链接
最新技术文章:
 
站内导航:
特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!