http://www.12342234.cn/index.html 是静态网页
http://www.12342234.cn/index.aspx 可以生成静态页面(我生成静态页面的原理 就是运行idnex.aspx),现在 在index.aspx中插入了yahoo的搜索代码(带有Form) 每次一提交 就提交到http://www.12342234.cn/index.aspx 中了 ,无法实现 yahoo的功能 希望帮我 解决这个大问题
http://www.12342234.cn/index.aspx 登陆看看就明白了
http://www.12342234.cn/index.aspx 可以生成静态页面(我生成静态页面的原理 就是运行idnex.aspx),现在 在index.aspx中插入了yahoo的搜索代码(带有Form) 每次一提交 就提交到http://www.12342234.cn/index.aspx 中了 ,无法实现 yahoo的功能 希望帮我 解决这个大问题
http://www.12342234.cn/index.aspx 登陆看看就明白了
你的设计有问题.
function yahooSearch(){
url = "http://search.union.yahoo.com.cn/click/search.htm?m=419326&b=&p=1006&a=&st=0&fw=union&name=";
obj = document.getElementById('searchName');
if (obj.value == '请输入关键字'){
obj.focus();
obj.value = '';
return false;
}
url = url + encodeURIComponent(obj.value);
window.open(url);
}
</script>
<input id="searchName" name="name" type="text" style="width:210px; *margin-right:.5em; " value="请输入关键字" onMouseOver="this.focus()" onBlur="if (value ==''){value='请输入关键字'}" onFocus="this.select()" onClick="if(this.value=='请输入关键字')this.value=''"/>
<input type="button" onclick="yahooSearch();" value="搜索" />
http://www.12342234.cn/Index.aspx上这两个代码 就明白了
<div style="height:27px; zoom:1; background:url(http://cn.yimg.com/p/un/070803/bg.gif) bottom repeat-x #fff; border:1px solid #ccc; width: 276px;">
<div style="margin:10px 0 0 5px; float:left; display:inline;">
<a href="http://search.cn.yahoo.com" target="_blank">
<img src="http://cn.yimg.com/p/un/070803/ylg.gif" alt="雅虎" border="0" /></a></div><div style="float:left; margin:7px 0 0 10px;">
<form action="http://search.union.yahoo.com.cn/click/search.htm?" method="get" style="margin:0; padding:0;" target="_blank" onsubmit="if (this.name.value == '请输入关键字')
{ this.name.focus(); this.name.value = ''; return false; }"> <input name="name" type="text" style="width:210px; *margin-right:.5em; " value="请输入关键字" onMouseOver="this.focus()" onBlur="if (value ==''){value='请输入关键字'}" onFocus="this.select()" onClick="if(this.value=='请输入关键字')this.value=''"/>
<button type="submit" style="padding:0 .3em">搜索</button>
<input name=m type=hidden value="419326">
<input name=b type=hidden value="">
<input name=p type=hidden value="1006">
<input name=a type=hidden value="">
<input name=st type=hidden value="0">
<input name=fw type=hidden value="union">
</form>
</div>
</div>
</div>是yahoo的源代码!
http://community.csdn.net/Expert/topic/5766/5766600.xml?temp=.6927149
给分 能给我讲讲 怎么想到这个的吗?我本来的 程序为什么不行 , 如果你做生成静态页面你 又会怎么做
QQ 46941598
MSN [email protected]
{ this.name.focus(); this.name.value = ''; return false; }"><input name="name" type="text" style="width:210px; *margin-right:.5em; " value="请输入关键字" onMouseOver="this.focus()" onBlur="if (value ==''){value='请输入关键字'}" onFocus="this.select()" onClick="if(this.value=='请输入关键字')this.value=''"/>
<button type="submit" style="padding:0 .3em">搜索</button>
<input name=m type=hidden value="419326">
<input name=b type=hidden value="">
<input name=p type=hidden value="1006">
<input name=a type=hidden value="">
<input name=st type=hidden value="0">
<input name=fw type=hidden value="union">
</form>
--------------------------------
其实上面yahoo代码就是在提交表单的时候用get方式取请求http://search.union.yahoo.com.cn/click/search.htm页面,而get方式就是把参数放啊url中(yahoo所需要的参数就是那些input组合出来的),既然是把参数放在url,我们就可以自己组合url,然后直接打开这个url就行,这样就跟get方式请求是一样的效果,所以我们就组合url成这样:
url = "http://search.union.yahoo.com.cn/click/search.htm?m=419326&b=&p=1006&a=&st=0&fw=union&name=";
前面的m,b,p等参数都是写死的参数,对应yahoo代码中的隐藏域中的值,最后的name参数就是用户输入的搜索关键词。你本来的 程序为什么不行,是因为你把yahoo的form直接嵌套到你自己的form中,form是不能嵌套的,所以默认会请求最外层的form。
----------------------------
直接把我的代码放在静态页面中就好了,因为的代码并没有form表单,所以放在如何位置都可以
protected override void Render(HtmlTextWriter writer)
{
System.IO.StringWriter html = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter tw = new HtmlTextWriter(html);
base.Render(tw);
System.IO.StreamWriter sw = new System.IO.StreamWriter(Server.MapPath("index.html"), false, System.Text.Encoding.UTF8);
sw.Write(html.ToString());
sw.Close();
tw.Close();
Response.Write("<script>alert('已经生成静态页面Index.html');</script>");
Response.Write("<script>window.location.href =('admin_/main.aspx');</script>");
}
来生成静态页面
每次都是运行 这个aspx 才生成的 index.html
1、不知道 成熟的 办法是怎么做 生成静态页面 2、希望求各代码 怎么生成静态页面。
只是生成首页(index.aspx) 为静态就可以.
{
System.IO.StringWriter html = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter tw = new HtmlTextWriter(html);
base.Render(tw);
System.IO.StreamWriter sw = new System.IO.StreamWriter(Server.MapPath("index.html"), false, System.Text.Encoding.UTF8);
sw.Write(html.ToString());
sw.Close();
tw.Close();
Response.Write("<script>alert('已经生成静态页面Index.html');</script>");
Response.Write("<script>window.location.href =('admin_/main.aspx');</script>");
}-----------------------------------------------------------
我目前的水平只会 浏览一个网页生成 这个网页的静态不知道你说的方法怎么实现 ,点Button 生成 静态
http://www.12342234.cn/index.aspx
PS:下午有点事,所以回的比较慢
System.Web.UI.HtmlTextWriter tw = new HtmlTextWriter(html);
base.Render(tw);
System.IO.StreamWriter sw = new System.IO.StreamWriter(Server.MapPath("index.html"), false, System.Text.Encoding.UTF8);
sw.Write(html.ToString());
sw.Close();
tw.Close();
Response.Write("<script>alert('已经生成静态页面Index.html');</script>");
Response.Write("<script>window.location.href =('admin_/main.aspx');</script
------ ---------------------
怎么指向 那个index.aspx网页呢,
-----------------------------------------是我没看清楚,原来你是要根据index.aspx页面上的东西来生成index.html,所以直接点击button不能实现,你必须打开你的index.aspx才能生成index.html。不过你不一定要跳转到index.aspx页面去生成,你可以在你点击Button的页面嵌入1个iframe,然后让这个iframe去加载index.aspx就行了
什么方法可以避免 把用户信息生成静态页面里。