李忠杰ID:sandyxxx
9939次访问,排名10708(-1)好友8人,关注者24
sandyxxx的文章
原创 18 篇
翻译 0 篇
转载 7 篇
评论 18 篇
最近评论
np7888090:输一个汉字里没有下拉菜单,需要加一个空格就会出现下拉菜单,而且也可以找到相应匹配这个汉字的结果,就是要加一个 空格,能不能直接输入一个汉字会就出现下拉菜单的?注,输入多个汉字也一样,就要+空格
np7888090:输入一个汉字再加一个空格才会出现下拉,也会找到相关内容,说明是有找到内容了,就是要加一个空格
sandyxxx:有没有下拉菜单,是看你有没有返回数据。你输入一个字母有菜单,说明有匹配这个字母的结果。你输入一个汉字没有菜单,说明没有匹配这个汉字的结果。
np7888090:我试过了可以,但有个问题,输入字母时输入单个字母就行了,输入汉字时要一个空格才会有下拉单,请问是什么问题,也急需帮忙
np7888090:我试过了可以,但有个问题,输入字母时输入单个字母就行了,输入汉字时要一个空格才会有下拉单,请问是什么问题,也急需帮忙
文章分类
收藏
相册
我的相册
友情连接
ajax 资料站
ASP.NET 入门教程
ASP.NET2.0 入门视频教程
javaresearch
Java家技术论坛
XML DOM 教程
zping个人感想
中国Java开发网
掌握ajax
浪曦视频.net
网站SEO
存档
软件项目交易
订阅我的博客
XML聚合  FeedSky
订阅到鲜果
订阅到Google
订阅到抓虾
订阅到BlogLines
订阅到Yahoo
订阅到GouGou
订阅到飞鸽
订阅到Rojo
订阅到newsgator
订阅到netvibes

原创 windows计划任务自动生成静态首页收藏

 | 旧一篇: JS省市二级联动菜单

indexplan.vbs: 脚本程序,调用ie组建执行生成首页的程序这里强调的是必须打开ie,要用到ie的组建,遨游好像不行。然后把这个脚本程序添加到windows计划任务里,设置好执行时间间隔,看你首页跟新的快慢了,自己把握。

Dim IE
Set IE = CreateObject("InternetExplorer.Application")
ie.navigate("http://localhost:80/createindex.asp")-这里在服务器换成你的域名指向你的生成文件
ie.visible=0
Set IE = Nothing
ASP版本
Server.ScriptTimeOut=9999999 

Function BytesToBstr(body,Cset)'防止乱码函数

	dim objstream

	set objstream = Server.CreateObject("adodb.stream")

	objstream.Type = 1

	objstream.Mode =3

	objstream.Open

	objstream.Write body

	objstream.Position = 0

	objstream.Type = 2

	objstream.Charset = Cset

	BytesToBstr = objstream.ReadText

	objstream.Close

	set objstream = Nothing

End Function



Function GetHTTPPage(Url)'获取Html代码函数

	err.clear

	On Error Resume Next

	dim http 

	set http=Server.createobject("Microsoft.XMLHTTP") 

	Http.open "GET",url,false 

	Http.send()

	if Http.readystate<>4 then

		exit function 

	end if 

	GetHTTPPage = bytesToBSTR(Http.responseBody,"GB2312")

	set http = Nothing

	If Err Then

	   response.write err.description

	   Response.Write "<br><br><p align='center'><font color='red'><b>无法抓取本页面信息!!!</b></font></p>"

	End If

End function

Url="http://www.xxxxx.com/index.asp"

strHtml=GetHTTPPage(Url)

filename=server.mappath("index.html")

if strHtml<>"" then'读取到首页源代码

    set fso = Server.CreateObject("scripting.FileSystemObject")

	if fso.FileExists(filename) then '静态首页存在,删除旧页面

	   fso.DeleteFile filename 

	   set fout = fso.CreateTextFile(filename,true,False)'重新生成

	   fout.write strHtml

	   fout.close

	   set fout=nothing

	   set fso=nothing

	 else

	   set fout = fso.CreateTextFile(filename,true,False)

	   fout.write strHtml

	   fout.close

	   set fout=nothing

	   set fso=nothing

	 end if 

end if
ASP.NET版本:
using System;

using System.Data;

using System.Configuration;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.Text;

using System.Text.RegularExpressions;

using System.IO;

using System.Net;



public partial class CreatIndex : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

        //index.html页面存在先删除旧页面,然后生成新页面

        if (File.Exists(@"E:\product\index.html"))

        {

            File.Delete(@"E:\product\index.html");

            string URL = "http://www.xxxx.com";

            string Content = GetHtmlContent(URL);

            CreateIndex(Content);

        }

        //index.html页面不存在直接生成

        else

        {

            string URL = "http://www.xxxx.com";

            string Content = GetHtmlContent(URL);

            CreateIndex(Content);

        }

    }

    //生成index.html页面

    protected void CreateIndex(string con)

    {

           string IndexPath = @"E:\product\index.html";  

           //StreamWriter sr = File.CreateText(@"E:\product\index.html");

            StreamWriter sr = new StreamWriter(IndexPath, true, System.Text.Encoding.GetEncoding("GB2312"));

            Response.Write("生成Index.html文件成功。生成时间:" + System.DateTime.Now);

            sr.WriteLine(con);

            sr.Close();

    }

    //读取网页源代码

    private string GetHtmlContent(string Url)

    {

        string strHtmlContent = "";

        try

        {

            //声明一个HttpWebRequest请求

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);

            //连接超时时间

            request.Timeout = 500000;

            request.Headers.Set("Pragma", "no-cache");

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            Stream streamHtmlCode = response.GetResponseStream();

            Encoding encoding = Encoding.GetEncoding("GB2312");

            StreamReader streamReader = new StreamReader(streamHtmlCode, encoding);

            strHtmlContent = streamReader.ReadToEnd();

        }

        catch

        {

            Response.Write("对不起出错了");

        }

        return strHtmlContent;

    }

}

发表于 @ 2008年07月04日 14:07:00|评论(loading...)|编辑|收藏

 | 旧一篇: JS省市二级联动菜单

评论:没有评论。

发表评论  


登录
Csdn Blog version 3.1a
Copyright © sandyxxx