window.location.Reload()和window…

 

<a οnclick="javascript:window.location.href=window.location.href;">

<a οnclick="javascript:window.location.reload();">

测试效果一样。表单没有提交。

<input type="submit" οnclick="javascript:window.location.reload();" value="单击" id="btnVCode" />
<input type="submit" οnclick="javascript:window.location.href=window.location.href;" value="单击" id="btnVCode" />

都提交数据

 

window.location.Reload()应该是刷新.(如果有数据提交的话,会提示是否提交的(是和否选项))
window.location.href=window.location.href; 是定向url提交数据

最好不要用location.reload(),而用location=location比较好,还有在模式窗口(showModalDialog和showModelessDialog)前者不能用。

 

reload参数有true和false,比较有意思?

避免重复提交:

    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            string nr = ((DataRowView)e.Item.DataItem).Row["GZZDS"].ToString();
            string id = ((DataRowView)e.Item.DataItem).Row["RZID"].ToString();
            string rid = ((DataRowView)e.Item.DataItem).Row["RWXH"].ToString();
            string link = "";

            if (nr == "")
            {
                link = "<a href='#' οnclick=\"selectGuide2('BookDoc.aspx?type=2&Id=" + id + "&rid=" + rid + "&Rnd='+Math.random()); location=location;\">选择指导书</a>";
            }
            else
            {
                string t = (ViewState["State"].ToString() == "Query" || ((DataRowView)e.Item.DataItem).Row["GZZT"].ToString() == "工作结束") ? "false" : "true";
                string path=((DataRowView)e.Item.DataItem).Row["GZZDSPath"].ToString();               

                link = "<a href='#' οnclick=\"EditWord('" + path + "'," + t + ")\">" + nr + "</a>";
            }

            ((Literal)e.Item.FindControl("Literal1")).Text = link;
        }
    }

 

 

 

window.location.Reload()应该是刷新.(如果有数据提交的话,会提示是否提交的(是和否选项))
window.location.href=window.location.href;
是定向url提交数据


是大的区别还是是否提交数据了

 

function refresh()
{
//刷新页面函数
//window.focus();刷新窗口
//document.execCommand("Refresh");刷新窗口
//self.location.reload();刷新当前窗口
parent.location.reload();刷新父窗口
//aaa.location.reload();弹出窗口刷新父窗口
  
使用window.location.replace() or window.location.href(), 来重新加载此页面不出现提示框

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值