方案1:
/// <summary>
/// 传入URL返回网页的html代码
/// </summary>
/// <param name="Url">URL</param>
/// <returns></returns>
public static string getUrltoHtml(string Url)
{
errorMsg = "";
try
{
System.Net.WebRequest wReq = System.Net.WebRequest.Create(Url);
// Get the response instance.
System.Net.WebResponse wResp =wReq.GetResponse();
// Read an HTTP-specific property
//if (wResp.GetType() ==HttpWebResponse)
//{
//DateTime updated =((System.Net.HttpWebResponse)wResp).LastModified;
//}
// Get the response stream.
System.IO.Stream respStream = wResp.GetResponseStream();
// Dim reader As StreamReader = New StreamReader(respStream)
System.IO.StreamReader reader = new System.IO.StreamReader(respStream, System.Text.Encoding.GetEncoding("gb2312"));
return reader.ReadToEnd();
}
catch(System.Exception ex)
{
errorMsg = ex.Message ;
}
return "";
}
你可以用这个函数获取网页的客户端的html代码,然后保存到.html文件里就可以了。
/// <summary>
/// 传入URL返回网页的html代码
/// </summary>
/// <param name="Url">URL</param>
/// <returns></returns>
public static string getUrltoHtml(string Url)
{
errorMsg = "";
try
{
System.Net.WebRequest wReq = System.Net.WebRequest.Create(Url);
// Get the response instance.
System.Net.WebResponse wResp =wReq.GetResponse();
// Read an HTTP-specific property
//if (wResp.GetType() ==HttpWebResponse)
//{
//DateTime updated =((System.Net.HttpWebResponse)wResp).LastModified;
//}
// Get the response stream.
System.IO.Stream respStream = wResp.GetResponseStream();
// Dim reader As StreamReader = New StreamReader(respStream)
System.IO.StreamReader reader = new System.IO.StreamReader(respStream, System.Text.Encoding.GetEncoding("gb2312"));
return reader.ReadToEnd();
}
catch(System.Exception ex)
{
errorMsg = ex.Message ;
}
return "";
}
你可以用这个函数获取网页的客户端的html代码,然后保存到.html文件里就可以了。
在编程序的过程中,通常遇到这样的情况,要求用户输入日期,结果,他们输入的不规范,导致程序结果最后出现错误,今天,我从网上,搜了一下,找了相应的代码。效果不错,与大家分享一下。
先看看演示吧:
演示:http://jed.dzhope.com/yanshi.php
怎么样?不错吧
第一步:
在< head>和< /head>之间加上:
<script language="JavaScript" src="Calendar30.js"></script>
第二步:
先看看演示吧:
演示:http://jed.dzhope.com/yanshi.php
怎么样?不错吧
第一步:
在< head>和< /head>之间加上:
<script language="JavaScript" src="Calendar30.js"></script>
第二步:
1、父子窗口
打开一个子窗口:
<a href='#' onClick='JavaScript:window.open("sub_win_name.html")'>open</a>
打开即最大化:
<body onLoad="window.resizeTo(screen.width, screen.height);window.moveTo(0, 0);">
得到父窗口的控件:
window.opener.document.forms[0].txt1.value;
得到父窗口全局javascript变量:
window.opener.var
刷新父页面:
self.opener.location='url of super page'
打开一个子窗口:
<a href='#' onClick='JavaScript:window.open("sub_win_name.html")'>open</a>
打开即最大化:
<body onLoad="window.resizeTo(screen.width, screen.height);window.moveTo(0, 0);">
得到父窗口的控件:
window.opener.document.forms[0].txt1.value;
得到父窗口全局javascript变量:
window.opener.var
刷新父页面:
self.opener.location='url of super page'
1.document.write(""); 输出语句
2.JS中的注释为//
3.传统的HTML文档顺序是:document->html->(head,body)
4.一个浏览器窗口中的DOM顺序是:window->(navigator,screen,history,location,document)
5.得到表单中元素的名称和值:document.getElementById("表单中元素的ID号").name(或&#118alue)
6.一个小写转大写的&#106s: document.getElementById("output").&#118alue = document.getElementById("input").&#118alue.toUpperCase();
7.JS中的值类型:String,Number,Boolean,Null,Object,Function
8.JS中的字符型转换成数值型:parseInt(),parseFloat()
9.JS中的数字转换成字符型:(""+变量)
10.JS中的取字符串长度是:(length)
11.JS中的字符与字符相连接使用+号.
2.JS中的注释为//
3.传统的HTML文档顺序是:document->html->(head,body)
4.一个浏览器窗口中的DOM顺序是:window->(navigator,screen,history,location,document)
5.得到表单中元素的名称和值:document.getElementById("表单中元素的ID号").name(或&#118alue)
6.一个小写转大写的&#106s: document.getElementById("output").&#118alue = document.getElementById("input").&#118alue.toUpperCase();
7.JS中的值类型:String,Number,Boolean,Null,Object,Function
8.JS中的字符型转换成数值型:parseInt(),parseFloat()
9.JS中的数字转换成字符型:(""+变量)
10.JS中的取字符串长度是:(length)
11.JS中的字符与字符相连接使用+号.
今天,把网址站转到新的服务器,不过,里面的$HTTP_REFERER不起作用。我改了半天,才发现。
当register_global = On 的时候$HTTP_REFERER打印出前一页的值
但是当register_global = Off 的时候就打印出空值了。
于是就把服务器的php.ini里的register_globals改为on就没有问题了。
后来又想,如果服务器不是自己的,自己没办法改该怎么做呢,就上网搜了一下。发上来吧。
********************************************************************
比如在
cardlist.php?sort=card_new_re&card_author=lidn&bbs_id=&r=1里有一个连接如下:
<a href='edit_card.php?card_id=$card_id&action=del' title='删除该主题'>删</a>
edit_card.php现在是这样写的:
$rs = mysql_query($query);
if($rs){
echo "<script language=javascript>";
echo "window.alert('操作成功!');";
echo "window.location='?????'";
echo "</script>";
}
我想知道怎么补充才能让这个程序执行以后回到card.php?sort=card_new_re&card_author=lidn&bbs_id=&r=1
这样的话就用:
$_SERVER['HTTP_REFERER']
或
$HTTP_SERVER_VARS['HTTP_REFERER']
**********************************************
当register_global = On 的时候$HTTP_REFERER打印出前一页的值
但是当register_global = Off 的时候就打印出空值了。
于是就把服务器的php.ini里的register_globals改为on就没有问题了。
后来又想,如果服务器不是自己的,自己没办法改该怎么做呢,就上网搜了一下。发上来吧。
********************************************************************
比如在
cardlist.php?sort=card_new_re&card_author=lidn&bbs_id=&r=1里有一个连接如下:
<a href='edit_card.php?card_id=$card_id&action=del' title='删除该主题'>删</a>
edit_card.php现在是这样写的:
$rs = mysql_query($query);
if($rs){
echo "<script language=javascript>";
echo "window.alert('操作成功!');";
echo "window.location='?????'";
echo "</script>";
}
我想知道怎么补充才能让这个程序执行以后回到card.php?sort=card_new_re&card_author=lidn&bbs_id=&r=1
这样的话就用:
$_SERVER['HTTP_REFERER']
或
$HTTP_SERVER_VARS['HTTP_REFERER']
**********************************************
1、拷贝PHP目录中的libeay32.dll 和 ssleay32.dll 两个文件到 system32 目录。
2、修改php.ini:配置好 extension_dir ,去掉 extension = php_curl.dll 前面的分号。
呵呵 就这么简单。
curl
curl是一个利用URL语法在命令行方式下工作的文件传输工具。它支持很多协议:FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE 以及 LDAP。curl同样支持HTTPS认证,HTTP POST方法, HTTP PUT方法, FTP上传, kerberos认证, HTTP上传, 代理服务器, cookies, 用户名/密码认证, 下载文件断点续传, 上载文件断点续传, http代理服务器管道( proxy tunneling), 甚至它还支持IPv6, socks5代理服务器, 通过http代理服务器上传文件到FTP服务器等等,功能十分强大。Windows操作系统下的网络蚂蚁,网际快车(FlashGet)的功能它都可以做到。准确的说,curl支持文件的上传和下载,所以是一个综合传输工具,但是按照传统,用户习惯称curl为下载工具。
2、修改php.ini:配置好 extension_dir ,去掉 extension = php_curl.dll 前面的分号。
呵呵 就这么简单。
curl
curl是一个利用URL语法在命令行方式下工作的文件传输工具。它支持很多协议:FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE 以及 LDAP。curl同样支持HTTPS认证,HTTP POST方法, HTTP PUT方法, FTP上传, kerberos认证, HTTP上传, 代理服务器, cookies, 用户名/密码认证, 下载文件断点续传, 上载文件断点续传, http代理服务器管道( proxy tunneling), 甚至它还支持IPv6, socks5代理服务器, 通过http代理服务器上传文件到FTP服务器等等,功能十分强大。Windows操作系统下的网络蚂蚁,网际快车(FlashGet)的功能它都可以做到。准确的说,curl支持文件的上传和下载,所以是一个综合传输工具,但是按照传统,用户习惯称curl为下载工具。
下载的是php5.05
已经内置有php_curl.dll,在ext目录下,此DLL用于支持SSL和zlib.
在php.ini中找到有extension=php_curl.dll, 去掉前面的注释.
设置extension_dir=c:\php\ext, 刷新PHP页面时报错, 说找不到模块php_curl.dll.
拷贝php_curl.dll 到windows\system32,还是同样的错.
在网上找了一下,需要将:
libeay32.dll, ssleay32.dll, php5ts.dll, php_curl.dll
都拷贝到system32目录下,重启IIS即可.
代码
<?php
$ch = curl_init();
$timeout = 10; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $_GET['q']);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$handles = curl_exec($ch);
curl_close($ch);
echo $handles;
?>
注,curl函数参考
curl_init
<?php
$ch = curl_init();
$timeout = 10; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $_GET['q']);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$handles = curl_exec($ch);
curl_close($ch);
echo $handles;
?>
注,curl函数参考
curl_init
具体的实现原理大家可以参考这篇文章
原文:http://www.alistapart.com/articles/cssdropshadows
中文翻译:http://www.onestab.net/a/ala/cssdropshadows.html
如果不想了解那么透彻的话,或者看了不太明白的,可以把下面的类加入到你的CSS中
只是发日志的时候有点麻烦,需要把你要加阴影的图片插入到< div class="img-shadow">< div>< /div>< /div>中,只插入到< div class="img-shadow">< /div>中就只有白边没有阴影了。
另外,因为IE不支持透明的PNG图片,所以你要把阴影图片和背景设为同一色才能看到好的效果。(可以看下面的演示图片)
原文:http://www.alistapart.com/articles/cssdropshadows
中文翻译:http://www.onestab.net/a/ala/cssdropshadows.html
如果不想了解那么透彻的话,或者看了不太明白的,可以把下面的类加入到你的CSS中
只是发日志的时候有点麻烦,需要把你要加阴影的图片插入到< div class="img-shadow">< div>< /div>< /div>中,只插入到< div class="img-shadow">< /div>中就只有白边没有阴影了。
另外,因为IE不支持透明的PNG图片,所以你要把阴影图片和背景设为同一色才能看到好的效果。(可以看下面的演示图片)
常用php页面跳转代码
常用php页面跳转代码
ASP页面:
<%response.redirect "页面路径"%>
有好几种方法:
(1)在页面中跳转:加入以下句子,2秒后跳到test.html
(2)2秒后转到ly2.php
(3)在php中用header()函数跳转:
(4)用一个按钮,点击后跳转:(5种按钮)
<input type=button value=Return onClick
="javascript:location.href('URL');">
<input type=button value=Return onClick=
"javascript:window.location.href('URL');">
<input type=button value=Return onClick
="javascript:window.location.replace('URL');">
<input type=button value=Return onClick
="javascript:window.location.assign('URL');">
<input type="button" value="Return" onClick
="window.location='URL'" /><!--这种最好-->
常用php页面跳转代码
<meta http-equiv=refresh content='1;url=index.php'>
<script>
url="submit.php?var=<?=$value?>";
window.location.href="/url";
</script>
url="submit.php?var=<?=$value?>";
window.location.href="/url";
</script>
<script>
window.open('url,'','_self');
</script>
window.open('url,'','_self');
</script>
<?
$page="index.php?bianliang=".$bianliang;
echo "<SCRIPT>window.location = \"".$page."\"; </SCRIPT>";
?>
$page="index.php?bianliang=".$bianliang;
echo "<SCRIPT>window.location = \"".$page."\"; </SCRIPT>";
?>
<meta http-equiv=refresh content="1;url=index.php?aaa=<? echo $aaa ?>">
ASP页面:
<%response.redirect "页面路径"%>
有好几种方法:
(1)在页面中跳转:加入以下句子,2秒后跳到test.html
<meta HTTP-EQUIV=REFRESH CONTENT='2; URL=test.html'>
(2)2秒后转到ly2.php
<script>setTimeout("location.href="/home/ly2.php'",2000)</script>
(3)在php中用header()函数跳转:
header("Location :http://www.xxx.com");
(4)用一个按钮,点击后跳转:(5种按钮)
<input type=button value=Return onClick
="javascript:location.href('URL');">
<input type=button value=Return onClick=
"javascript:window.location.href('URL');">
<input type=button value=Return onClick
="javascript:window.location.replace('URL');">
<input type=button value=Return onClick
="javascript:window.location.assign('URL');">
<input type="button" value="Return" onClick
="window.location='URL'" /><!--这种最好-->