Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

window.location with ie5 and win98 doesn't work

Status
Not open for further replies.

jtduckman

Programmer
Aug 27, 2002
3
US
Hi,
I can't seem to get window.location to redirect to another page on a machine with ie5 and win98. the page works fine on a machine with xp and ie6.
here is my code:

<SCRIPT LANGUAGE=&quot;Javascript&quot;>

function chkDelete(xpara){
if (confirm(&quot;Are you sure you want to Delete this Item?&quot;)) {
window.location.href = &quot;deleteitem.asp?item=&quot; + xpara;
}
else {
alert(&quot;Delete cancelled&quot;);
}

}
</SCRIPT>

in the body i use:

response.write &quot;<a href='#' onclick='chkDelete(&quot; & i & &quot;)'><img src='graphics/trash_transwh.gif' border=0></a>&quot;

I tried using a complete URL and that didn't work.
I tried using window.location.href and that didn't work.

Has anyone seen this or know of a fix?

Thanks in advance.

JTDuckman
 
Try changing the href in your link:

response.write &quot;<a href='javascript:chkDelete(&quot; & i & &quot;)'><img src='graphics/trash_transwh.gif' border=0></a>&quot;
 
instead of using:

window.location.href = &quot;deleteitem.asp?item=&quot; + xpara;

try using:

self.location.href = &quot;deleteitem.asp?item=&quot; + xpara;


This should work much better..

Cheers,

Gorkem.

 
window.location.href works in IE4. There must be another issue. Is there a issue with the IIS or PWS possibly that you are running on the older machine that is not concurant with the newer? Was it something I said?
admin@onpntwebdesigns.com
 
Well, I tried &quot;self.location.href&quot; and that didn't work and I tried
response.write &quot;<a href='javascript:chkDelete(&quot; & i & &quot;)'><img src='graphics/trash_transwh.gif' border=0></a>&quot;
and that didn't work.

ther server is a NT 4.0 server with sp6.

for some reason ie6 likes it fine. I put an alert in the &quot;delete&quot; section to see if it was getting to that section of code and it confirmed that it was. but for some reason the redirection just isn't taking place.
 
Try document.location = 'deleteitem.asp';

location property is belong to document, and document is belong to window object. No need the href after location.
 
If you do want to, I'll show you how to do it in VBS -Phil
fillup07@hotmail.com
 
Please do. I just need a solution and VBSCRIPT is fine with me. the page is an ASP page.


Thanks,

James
 
Well a redirect in ASP is just:
<% response.redirect page %>
But if you need that javascript alert, and want to continue in Javascript, then replace your entire window.location.href stuff with just:

location=xpara -Phil
fillup07@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top