大家帮我看看这句问题在哪里?

fighter222 2008-12-19 08:49:14
sqlRdr.GetValue(0)是取出来的id值,可是这句话不起作用

<a href='#' OnClick=" + "javascript:window.open('http://99.8.124.132/infoview.asp?id=' + sqlRdr.GetValue(0) + '&ts='+tz','width=400,height=400;toolbar=no;');
...全文
124 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
fighter222 2008-12-19
  • 打赏
  • 举报
回复
恩,确实,单引号双引号现在用的有点不清不楚的,谢谢各位了,我搞定了
三碗猪脚 2008-12-19
  • 打赏
  • 举报
回复
改为<a href='#' OnClick='javascript:window.open('http://99.8.124.132/infoview.asp?id=" + sqlRdr.GetValue(0) + "&ts='+tz','width=400,height=400;toolbar=no;');'" + "><font face='verdana' size='2' color='#000000' style='TEXT-DECORATION:none;'>" + sqlRdr.GetValue(1) + "</font></a><br><br>";

数主你的单引号双引号混的不清楚,建议用转义,好DEBUG
fighter222 2008-12-19
  • 打赏
  • 举报
回复
还是没找到问题所在
fighter222 2008-12-19
  • 打赏
  • 举报
回复
ls能不能说详细点
zglover 2008-12-19
  • 打赏
  • 举报
回复
楼主写代码要细心啊!
fighter222 2008-12-19
  • 打赏
  • 举报
回复
呵呵,先做个测试,用的时候再改,以上的好像都不行哦,我贴完整点的出来


using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Controls_callborad : System.Web.UI.UserControl
{



protected void Page_Load(object sender, EventArgs e)
{

string s = "server=local;database=temp;uid=sa;pwd=;";
SqlConnection conn = new SqlConnection(s);


string strSql = "select top 10 tzid,tztitle,tztime from dbo.tzdb order by tzid desc";
string strScrolling = "";

HtmlTableCell cellScrolling = new HtmlTableCell();
SqlCommand myComd = new SqlCommand(strSql, conn);
SqlDataReader sqlRdr;

try
{
conn.Open();
sqlRdr = myComd.ExecuteReader();
strScrolling = "<Marquee OnMouseOver='this.stop();' OnMouseOut='this.start();' direction='up' scrollamount='1' bgcolor='#ECF0EE' width='90%' scrolldelay='50'>";
while (sqlRdr.Read())
{
strScrolling = strScrolling + "<a href='#' OnClick=" + "javascript:window.open('http://99.8.124.132/infoview.asp?id=' + sqlRdr.GetValue(0) + '&ts='+tz','width=400,height=400;toolbar=no;');" + "><font face='verdana' size='2' color='#000000' style='TEXT-DECORATION:none;'>" + sqlRdr.GetValue(1) + "</font></a><br><br>";

}
strScrolling = strScrolling + "</Marquee>";
sqlRdr.Close();
cellScrolling.InnerHtml = strScrolling;
rowScrolling.Cells.Add(cellScrolling);
}

catch (Exception msg)
{
Response.Write(msg.Message);
}
finally
{
conn.Close();
}


gtiroy 2008-12-19
  • 打赏
  • 举报
回复
没有 />
qq175691524 2008-12-19
  • 打赏
  • 举报
回复
楼上正解
huxuanhui 2008-12-19
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 jiang_jiajia10 的回复:]
" + "这句是做什么的
[/Quote]

同样疑惑
orain 2008-12-19
  • 打赏
  • 举报
回复
不要写在 onclick 里,要写在 href 里,如
<a href="javascript:void(window.open('http://www.csdn.net'))">CSDN</a>
注意那个 void, 因为 window.open 会返回一个值的,如果不把返回值屏蔽,会覆盖掉你原本的链接
jiang_jiajia10 2008-12-19
  • 打赏
  • 举报
回复
还有URL最好别用绝对路径。一旦你要换服务器呢
caofan520 2008-12-19
  • 打赏
  • 举报
回复
<a href='#' OnClick=" + "javascript:window.open('http://99.8.124.132/infoview.asp?id=" + sqlRdr.GetValue(0) + "&ts="+tz+"','width=400,height=400;toolbar=no;');">
jiang_jiajia10 2008-12-19
  • 打赏
  • 举报
回复

<a href='#' OnClick="javascript:window.open('http://99.8.124.132/infoview.asp?id=' + sqlRdr.GetValue(0) + '&ts='+tz','width=400,height=400;toolbar=no;'");


jiang_jiajia10 2008-12-19
  • 打赏
  • 举报
回复
" + "这句是做什么的
sprc_lcl 2008-12-19
  • 打赏
  • 举报
回复
<a href=# onclick="javascript:window.open('http://99.8.124.132/infoview.asp?id=' + sqlRdr.GetValue(0) + '&ts='+tz,'_blank','width=400,height=400;toolbar=no;');">
sprc_lcl 2008-12-19
  • 打赏
  • 举报
回复
如果是前台代码:
<a href=# OnClick="javascript:window.open('http://99.8.124.132/infoview.asp?id=' + sqlRdr.GetValue(0) + '&ts='+tz,'width=400,height=400;toolbar=no;');">

62,266

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧