function Getkeyword()
{
var url="<%=Getshiming() %>";
if(url!="")
{
alert(url);
window.open(url);
}
<input type="Button" class="btn" id="su" value="搜 索" style="margin-right:10px; float:left;" onclick="Getkeyword()">其中Getshiming()是得到url的方法
为什么我在第一次点搜索的时候不能跳出一个新的地址为url的页面来啊,url是有值的,点第二次的时候就跳出一个新的页面了,求高手(一开始的时候url为空),但是点搜索的时候url就有值了
{
return "http://www.baidu.com";
}
public string Getshiming()
{
string url = "";
DataSet ds = Control.GetValue(SqlManager.Getshiming(keyword));
if (IsNullOrEmp(ds))
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
url = "http://" + Convert.ToString(ds.Tables[0].Rows[i]["net_path"]);
}
}
return url;
}
这个是Getshiming()的的方法
var url="<%=Getshiming() %>";
if(url!="")
{
alert(url);
window.open(url);
}又判断如果为空就不执行,当然就不会出来额!
function Getkeyword()
{
var html="<%=Getshiming() %>";
var url=html.length==0?"http://baidu.com":html;
if(url!="")
{
alert(url);
window.open(url);
}
}