what is wrong with it?
try:
hlink.Attributes.Add["onclick"] = @"<script > window.open('practics.aspx?id="+"1" +" ','popwindow','menubar=0,toolbar=no,location=no,directories=no,status=no,resizable=no,top=100,left=100,width=600,height=500');</script>";
try:
hlink.Attributes.Add["onclick"] = @"<script > window.open('practics.aspx?id="+"1" +" ','popwindow','menubar=0,toolbar=no,location=no,directories=no,status=no,resizable=no,top=100,left=100,width=600,height=500');</script>";
wait i try
string str = @"<script > window.open('practics.aspx?id="+"1" +" ','popwindow','menubar=0,toolbar=no,location=no,directories=no,status=no,resizable=no,top=100,left=100,width=600,height=500');</script>";hlink.Attributes.Add("onclick", str);
can't
menubar=0,toolbar=no
改为
menubar=no,toolbar=no
HyperLink hlink = new HyperLink();
hlink.Attributes["onclick"] = @"<script > window.open('practics.aspx?id="+"1" +" ','popwindow','menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no,top=100,left=100,width=600,height=500');</script>";
this is ok.
我也以为
HyperLink hlink = new HyperLink();
hlink.Attributes["onclick"] = @"<script > window.open('practics.aspx?id="+"1" +" ','popwindow','menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no,top=100,left=100,width=600,height=500');</script>";
这样就是对的。但是,事实上是,叶面上没有任何链接,hlink.Text可以取出来。点这个text没反应。
对了,我这个是动态table里面的一个hyperlink cell。
再看看还有没有人能给我点建议,没人的话,就把这分散了八。
TableCell c=new TableCell();
HyperLink hlink = new HyperLink();
hlink.Attributes["onclick"] = @"<script > window.open('practics.aspx?id="+"1" +" ','popwindow','menubar=0,toolbar=no,location=no,directories=no,status=no,resizable=no,top=100,left=100,width=600,height=500');</script>";r.Height=32;
c.Controls.Add(hlink);
r.Cells.Add(c);
TableFile.Rows.Add(r);//这样应该可以了!
直接用hlink.atrrbutes["onclick"] = "javascript:windows.open()";
倒是可以,不过由于要传递变量参数,也烦得很。而且下面也看不出来是链接。
谢谢大家了。兄弟们,接分阿。