火车采集器软件交流官方论坛

 找回密码
 加入会员
搜索
火车采集器V9版免费下载火车浏览器 - 可视采集,万能群发,全自动脚本工具
查看: 3099|回复: 6

发个网站 大家给个思路

[复制链接]
发表于 2011-2-24 18:04:58 | 显示全部楼层 |阅读模式
http://www.jfyfdm.com/index.aspx
发表于 2011-2-24 18:31:42 | 显示全部楼层
呵呵。你要的是什么思路
发表于 2011-2-24 20:13:30 | 显示全部楼层
属于分页不变问题
post提交的,只是页码部分没有直接的源码,通过源码里德PageCode('3','25','divpage','IndexList.aspx')函数设置的页码部分,找到这个函数问题就可以解决了
http://www.jfyfdm.com/index.js理可以找到这个函数,//页码
  1. //Current当前页码
  2. //Total总记录数
  3. //得到页码的HTML
  4. PageCode('3','25','divpage','IndexList.aspx');isnone('f','1',0);
  5. function PageCode(current=3, Total=25, divId=divpage, urlStr=IndexList.aspx) {
  6.     //当前页码的前后页码数
  7.     var k = 5;//每页显示页码数的-1的一半
  8.     var PageStr = "";//页码字符串
  9.     current = isNaN(current) || (typeof current) == 'undefined' ? 1 : parseInt(current);//当前页
  10.     //根据当前页显示的显示页码数目,获取数据。
  11.     var beginCode = Math.max(1, current - k);//每页显示的开始页码
  12.     var endCode = Math.min(Math.max(current + k, k * 2 + 1), Total);//显示的结束页码
  13.     if (current > 1) {//非第一页
  14.         PageStr += "<a style='cursor:pointer' pageCode='" + (current - 1) + "' >上一页&nbsp;</a>";//上一页
  15.     }
  16.     for (var i = beginCode; i < endCode + 1; i++) {
  17.         PageStr += ("<a style='cursor:pointer' pageCode='" + i + "' >&nbsp;" + i + "&nbsp;</a>");//生成中间页码
  18.     }
  19.     if (current < endCode) {
  20.         PageStr += "<a style='cursor:pointer' pageCode='" + (current + 1) + "'>&nbsp;下一页</a>";//下一页
  21.     }
  22.     //PageStr += "到第<input name='input2' type='text' class='pageinput' size='4' maxlength='8' id='pageIndexInput' /><input type='button' class='pagebtn' value='确定'pageCode='1'  id='pagebtn' />";
  23.     $("#" + divId).html(PageStr);//

  24.     //设置当前页样式
  25.     var aCount = $("#" + divId + " a").size();//获得id为divId的层,就是页码的容器层下的a连接
  26.     if (aCount > 0) {
  27.         $("#" + divId + " a").each(function() {//
  28.             var pageCodeValue = $(this).attr("pageCode");
  29.             if (pageCodeValue == current) {//当前页设置背景色
  30.                 $(this).css("color", "white");
  31.                 $(this).css("background","#077ac7");
  32.             }
  33.         })
  34.     }
  35. 下面的是关键部分:
  36.     $("#" + divId + " a").bind("click", function() {//为页码的容器层下的a连接设置点击的处理函数
  37.         //这里加上事件函数
  38.         var current = $(this).attr("pageCode");//获得点击连接的pageCode的值,代表第几页
  39.         if($("#"+divId).children("#pageindex").length<1)//没有id 为pageindex的对象,新建
  40.         {
  41.             $("#"+divId).append("<input type='hidden' id='pageindex' name='pageindex'/>")//在页码的容器层下的加入name为pageindex的控件,代表分页
  42.         }
  43.         $("#pageindex").val(current);//设置请求的页码值
  44.         $("#ListForm").submit();//id为ListForm表单提交
  45.         //window.location.href = urlStr + "?us=fy&pageindex=" + current + "";
  46.         // return false;
  47.     });
  48. }
复制代码
还有个isnone('f','1',0);也是有用的,它设置了ListForm表单中一些隐藏控件的值,搜索类型等
  1. 以这个为例isnone('f','1',0)

  2. function isnone(message,sta,aindex)
  3. {
  4.     var vcontent="";//搜索结果的字符串
  5.     if(sta=="0")//没有搜索到数据
  6.     {
  7.         vcontent="没有关于<font color="red">" + message + "</font>的任何记录,是否<a href="AddCompany.aspx" >立即加入</a>";
  8.     }
  9.     else
  10.     {
  11.         vcontent="关于<font color="red">" + message + "</font>的记录如下:"
  12.     }
  13.     $("#jieguo").html(vcontent);//
  14.     $("#seachword").val(message);//设置id为seachword的控件的值为message,这里是f,我搜的就是f,代表搜索的关键字
  15.     var alla=$(".option").eq(0).find("a");//这个地方是搜索的几个类型,公司,资讯,厂商办事处,电子书
  16.     var thisa=alla.eq(aindex);//取aindex=0的
  17.     alla.each(function(){
  18.         if($(this).attr("class")=="option_hover")//移除所有option_hover类的属性,加上option_not,即没有选上
  19.         {
  20.             $(this).removeAttr("class");
  21.             $(this).attr("class","option_not");
  22.         }
  23.     })
  24.     thisa.removeAttr("class");
  25.     thisa.attr("class","option_hover");//把选择的类型设置option_hover类
  26.     $("#seachtype").val(aindex);//id为seachtype的表单控件的值设置为aindex,这里是0,可以知道0公司,我搜索的是公司 1资讯 2厂商办事处  3电子书
  27. }
复制代码
再看这个提交表单<form name="ListForm" method="post" action="IndexList.aspx" id="ListForm" enctype="multipart/form-data">

里面的控件<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTczMDMyODkzM2RkCx9F4sqCLSyLZ7qZYuuwO/5JM9k=" />-------------post随机值

<input type="hidden" id="seachtype" name="seachtype" value="0" />-----搜索的类型0公司,1资讯 2厂商办事处  3电子书

<input onfocus="
                            value="请输入要搜索的关键词" name="seachword" --------------------搜索的关键字



<input type='hidden' id='pageindex' name='pageindex'/>------------------js添加的,直接看不到,代表分页

由于是ASP的,所以无法用get提交,只能post,VIEWSTATE搜了下,也了解些作用
 楼主| 发表于 2011-2-27 17:34:30 | 显示全部楼层
这个有点复杂 那位高手帮忙做个规则把 我是新手 学习学习
 楼主| 发表于 2011-2-27 17:58:30 | 显示全部楼层
输入洛阳 把EMAIL 提出来  给个规则学习学习
发表于 2011-2-27 18:36:36 | 显示全部楼层
本帖最后由 zhouchanglin 于 2011-2-27 18:38 编辑

回复 5# huxiaoming168

搜洛阳的公司,中文要编码,是urlencode编码,你可以找到在线的网站,把要搜索的中文编码后,再在post数据里是编码的,要不是乱码,你可以点分页看抓到的post数据
,其中pageindex参数代表页码,只需要设置这个就行了

post数据:__VIEWSTATE=[POST随机值1]&seachtype=0&seachword=%E6%B4%9B%E9%98%B3&pageindex=[分页]
里面参数的意识
seachword --------------搜索的关键字,中文要urlencode编码

seachtype----------搜索类型 0公司,1资讯 2厂商办事处  3电子书

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?加入会员

x
 楼主| 发表于 2011-2-27 18:51:40 | 显示全部楼层
谢谢 非常感谢
您需要登录后才可以回帖 登录 | 加入会员

本版积分规则

企业微信|手机版|Archiver|火车采集器官方站 ( 皖ICP备06000549 )

GMT+8, 2026-5-2 22:46

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表