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!

New Window w/o actual opening a new IE window

Status
Not open for further replies.

blackte

Programmer
Jul 24, 2001
80
US
I have an asp application that I have several question pages on. Based on those questions, I will need to display another asp page. Within my "vbscript code" is there a way to link to another page without opening another IE window.

Currently I have coding like
If ..... Then
msgbox(" ")
Else
window.open "my.asp"

The "window.open" command actually opens the second window.
I want the second page to open like a link or a href command does in HTML(replaces the first window). Can anyone point me in the correct direction. Can this even be done in vbscript?

Thanks in advance for the help with this.


Thanks TBlack.
 
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate2 "my.asp"
While IE.busy
wscript.sleep 10
Wend

'More code on what to do when it is done navigating.

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Mark, attached is the code that I added, but did not work. Not sure if I'm doing something wrong. Thanks again for your help with this.


<script language="vbscript">
<!--
Sub CheckAnswers

dim IE

If (CSQRevAdj.Q1(0).checked = False) Then
set IE = createobject("InternetExplorer.Application")
ie.navigate2 "csqrevadj.c.asp"
End If

-->
</script>


Thanks TBlack.
 
so long as you are sure that the conditions of the If Then are met, try giving IE the full http path to your ASP page.

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Mark, added the full path, still does not work. Added a message box to make sure that I'm getting into the if and the message box does display. Thanks

If (CSQRevAdj.Q1(0).checked = False) Then
msgbox("test")
set IE = createobject("InternetExplorer.Application")
ie.navigate2 "end if


Thanks TBlack.
 
hi Blackte, I think this was my bad. I just noticed I gave you CreateObject but you already have IE open so you should do a GetObject

Let me know how you make out after making that change.

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Mark, changed to use getobject, now getting a syntax error on the getobject statement. Thanks


If (CSQRevAdj.Q1(0).checked = False) Then
msgbox("test")
set IE = getobject("InternetExplorer.Application")
ie.navigate2 "CSQRevAdj_C.asp"
End If

Thanks TBlack.
 
Found this on the Internet;

Function FindIE(WhatTitle)
On Error Resume next
Dim sha
Dim sh
Set sha=CreateObject("Shell.Application")
For Each sh In sha.Windows
loc=InStr(1,sh.Document.Title,WhatTitle,1)
If Err.Number Then
Err.Clear
loc=0
End If
If Loc<>0 Then Exit for
Next
If Loc=0 Then 'Looped all windows and didn't find it
FindIE=False
Else
set FindIE=sh
End If
End Function

You might need to specify the title for the IE window already running. can you do that?

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
And what about something like this ?
window.document.location = "CSQRevAdj_C.asp"

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
PHV, thanks for the help, but does not seem to change the window. It just redisplays the current window.

Thanks for the help.

If (CSQRevAdj.Q1(0).checked = False) Then
msgbox("test")
window.document.location = "CSQRevAdj_C.asp"
End If

Thanks TBlack.
 
Is CSQRevAdj_C.asp the actual page ?
I was meaning at something like this:
window.document.location = "AnotherPage.asp"

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
PHV, CSQRevAdj_C.asp is an actual page that will display based on answers from the original page CSQRevAdj.asp. I'm setting on the original page CSQRevAdj.asp and press an OK button the will validate the answers, then I need CSQRevAdj_C.asp to display within the current window. I do not want another IE window to open.

Thanks in advance for the help.

Thanks TBlack.
 
And the window.document.location = "CSQRevAdj_C.asp" code is in CSQRevAdj.asp ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
PHV, yes the document statement is within CSQRevAdj.asp. I have it coded within the if logic of a vbscript routine.

Thanks.

Thanks TBlack.
 
OK, I am a newbie as far as vb and asp are concerned, but what about using response.redirect?
 
WCBurton, I have tried the response.redirect and it does not work. The issue becomes I think is that this code is in a sub routine inside of vbscript.

Thanks for your help.

Thanks TBlack.
 
The answer to my question is below. Basically the action tag on the form statement was being fired everytime I pressed the OK button, so to override the action tag, I used the following command.



document.OldPage.action = "NewPage.asp"


Thanks

Thanks TBlack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top