| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 754 人关注过本帖
标题:[求助]iframe不能正确传ID问题!(有代码)
只看楼主 加入收藏
lvye
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2006-7-17
收藏
 问题点数:0 回复次数:6 
[求助]iframe不能正确传ID问题!(有代码)

偶参考过论坛的一些贴,还是不能解答自己的问题..
1.偶要达到的效果是利用iframe显示文章内容,
2.偶试过<iframe sre="**.asp?id="></iframe>.不行.结果还是返回偶的测试错误.

3.文件:onews.asp 部分关键代码

<!--#include file="conn/conn.asp" -->
<%owen=request("id")%>
<html>
<head>
<title>::##</title>
<link rel="stylesheet" href="mycss.css" type="text/css">
</head>
<body>

<%
Set rsnews=Server.CreateObject("ADODB.RecordSet")
sql="update news set hits=hits+1 where id="&cstr(request("id"))
conn.execute sql
sql="select * from news where id="&owen
rsnews.Open sql,conn,1,1
title=rsnews("title")
if rsnews.eof and rsnews.bof then
response.Write("数据库出错")
else
%>
<table>
<tr><td>
<IFRAME STYLE="border: 0" src="onew3.asp?id="WIDTH=752 HEIGHT=400 marginheight="0" marginwidth="0" frameborder="0" scrolling="yes" ></IFRAME>
</td>
</tr><TABEL>
<%
end if
rsnews.close
set rsnews=nothing
%>

4.文件:onews3.asp,作用是显示内容
<html>
<head>
<link href="mycss.css" rel="stylesheet" type="text/css">
<!--#include file="conn/conn.asp" -->
</head>
<body>
<%
Set rsnews=Server.CreateObject("ADODB.RecordSet")
sql="update news set hits=hits+1 where id="&cstr(request("id"))
conn.execute sql
sql="select * from news where id="&owen
rsnews.Open sql,conn,1,1
title=rsnews("title")
if rsnews.eof and rsnews.bof then
response.Write("数据库出错")
else
%>
<table width="750" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td align="center" class="style20" width="750" height="15">&nbsp;</td>
<tr>
<td class="STYLE1" >
<%= rsnews("content") %>
</td>
<tr>
<td class="STYLE1" style="border-bottom: 1 dotted #666666" width="750" height="10">&nbsp;</td>
<tr>
<td class="STYLE1"width="750" height="15" >&nbsp;</td>
<tr>
<td class="STYLE1" ><%
Set Rs = conn.execute("Select id,title from news where id = "& id-1)
if Rs.eof and Rs.bof then
Response.write "上一篇:已经没有了。"
else
Response.write "上一篇:<a href=onews.asp?id="& rs(0) &">"& rs(1) &"</a>"
end if
%>
&nbsp;
<%
rs.close
Set Rs = conn.execute("Select id,title from news where id = "& id+1)
if Rs.eof and Rs.bof then
Response.write "下一篇:已经没有了。"
else
Response.write "下一篇:<a href=onews.asp?id="& rs(0) &">"& rs(1) &"</a>"
end if
rs.close
%></td>
<tr>
</table>
<%
end if
rsnews.close
set rsnews=nothing
%>
</body>
</html>


5.结果是"数据库错误."

[此贴子已经被作者于2006-7-25 14:25:50编辑过]

搜索更多相关主题的帖子: iframe 代码 
2006-07-25 14:24
jnzsk
Rank: 1
等 级:新手上路
威 望:1
帖 子:403
专家分:0
注 册:2004-11-13
收藏
得分:0 
得刷新一下网页才能传值吧?
你数据库有没有数据?

2006-07-25 14:30
lvye
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2006-7-17
收藏
得分:0 
刷新一下网页才能传值吧?
请问什么意思?
数据库里有数据啊.
onews.asp我也调用了其他的值..
可以显示,就是iframe里面的不行
2006-07-25 14:36
jnzsk
Rank: 1
等 级:新手上路
威 望:1
帖 子:403
专家分:0
注 册:2004-11-13
收藏
得分:0 
我是说你刷新一下iframe所在的网页,看看能不能传值!

2006-07-25 14:39
lvye
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2006-7-17
收藏
得分:0 
<%owen=request("id")%>
这个会不会有错
2006-07-25 14:39
jnzsk
Rank: 1
等 级:新手上路
威 望:1
帖 子:403
专家分:0
注 册:2004-11-13
收藏
得分:0 

你的ID是什么类型的?
你把request("id")换成reqeust.querystring("id")试试


2006-07-25 14:41
lvye
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2006-7-17
收藏
得分:0 
以下是引用jnzsk在2006-7-25 14:39:01的发言:
我是说你刷新一下iframe所在的网页,看看能不能传值!

不能窝.还是数据库错误..

2006-07-25 14:48
快速回复:[求助]iframe不能正确传ID问题!(有代码)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019149 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved