<script language="JavaScript" type="text/javascript">
if (location.href.indexOf('?dest=') > 0)
window.open('/about.aspx', 开发者_运维技巧'', '')
</script>
how do i make this work. Its in aspx file.
The following script will test for the existence of the 'dest=' key in the current page's querystring, and if it exists, will open a window to about.aspx with the querystring appended to the URL.
<script language="JavaScript" type="text/javascript">
if (window.location.search.indexOf('dest=') > 0) {
window.open('/about.aspx' + window.location.search, '', '');
}
</script>
Change the window.open line to
window.location = '/about.aspx';
Include the semicolon, which is missing in your code.
Your issue is the location.href...
part. It needs to be window.location.href...
if (window.location.href.indexOf('?dest=') > 0){
window.open('/about.aspx'+window.location.search, '', '');
}
Cheers
精彩评论