如何在javascript中重定向页面 [英] how to redirect page in javascript

查看:137
本文介绍了如何在javascript中重定向页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的index.aspx中的代码..在我给出的最后一行window.open ...所以,它打开一个名为Home.aspx的新窗口,而index.aspx仍然是显示但index.aspx必须消失,当我移动到Home.aspx..how要做。有人帮我知道?..





the following is my code which is in my index.aspx ..in the last line i gave as window.open...so,it is opening to a new window called Home.aspx and still the index.aspx is shown but index.aspx has to disappear when i move to Home.aspx..how to do.anyone help me know?..


<script type="text/javascript" > 
function pageopen()
{
var Hid = document.getElementById('HiddenFieldCity');
var HidA = document.getElementById('HiddenFieldArea');
var HidC = document.getElementById('HiddenFieldComm');
var HidD = document.getElementById('txtDate');
if (document.getElementById('ddlone').value=="Select Here")
{
alert("Please Select City");
return false;
}
window.open('Home.aspx?hid=' + Hid.value + '& HidA=' + HidA.value + '& HidC=' + HidC.value + '& HidD=' + HidD.value + '',"Welcome","titlebar=0,fullscreen=0,addressbar=0,left=0,top=0,maximized=yes,width=1024,height=700,scrollbars=no,resizable=yes") 
}

推荐答案

您好deepa ashwi ,



试试这个房产( window.location.href )。



window.location.href 不是方法,它是将告诉您浏览器当前URL位置的属性。将属性设置为不同的属性将重定向页面。



此外, window.location 在所有兼容的浏览器上都是可读/写的。 />


但是, document.location 在Internet Explorer(至少)中是只读的,但在基于Gecko的浏览器中读/写(Firefox, SeaMonkey)。



谢谢,

RelicV
Hi deepa ashwi,

Try this property (window.location.href).

window.location.href is not a method, it's a property that will tell you the current URL location of the browser. Setting the property to something different will redirect the page.

Also, window.location is read/write on all compliant browsers.

But, document.location is read-only in Internet Explorer (at least), but read/write in Gecko-based browsers (Firefox, SeaMonkey).

Thank you,
RelicV


这篇关于如何在javascript中重定向页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆