Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 227
  • Last Modified:

Opening an asp page with button click for specific frame

How do I instruct through asp response.redirect method to open a specific asp page in a specific frame target? I can do this with an <a>anchor but has never tried it with response.redirect or even vbscript.

Can you please help
Thanks
0
Freelancer
Asked:
Freelancer
1 Solution
 
weesiongCommented:
Freelancer,

<script>
window.frame1.location = "xxx.asp"
</script>

<script>
window.parent.location = "xxx.asp"
</script>

This is javascript :0

Regards,
Wee Siong
0
 
anupkaradeCommented:
hi
   you can use <a href> very well in this case
   
 Firstly give names to all your frames
  ex mainframe, rightframe, leftframe

code goes as follows:-
<a href="Yourpage.asp" target="mainframe">link</a>

this will help
                      regards
                      Anup        

0
 
choroqueCommented:
You have to use client side javascript or vbscript.

<body>

<form name="myform">

</form>


<%'your asp code
if something then%>

<script language="javascript">
  myform.action = "mypage1.asp" ;
  myform.target = "myframetarget" ;
  myform.submit();
</script>

<%else%>

<script language="javascript">
  myform.action = "mypage2.asp" ;
  myform.target = "myframetarget" ;
  myform.submit();
</script>

<%end if%>

</body>
0
 
makerpCommented:
if your form is calling a page and you want the results to appear in another frame simply set the TARGET="frame_name" in the <FORM> tag
0
 
Michel SakrCommented:
How do I change the target frame or window of a response.redirect?     (13,787 requests)
With client-side code, such as top.<target>.location.href= ...
ASP is on the server and does not "see" frames.
 
Instead of response.redirect, use code like this:
 
<%
    url = "http://wherever.com/
    response.write("<script>" & vbCrLf)
    response.write("parent.targetframename.location.replace('" & url & "');" & vbCrLf)
    response.write("</script>")
%>
 
 
Or this:
 
<%
    url = "http://wherever.com/
    response.write("<script>" & vbCrLf)
    response.write("parent.targetframename.location.href='" & url & "';" & vbCrLf)
    response.write("</script>")
%>
 
 
I prefer the replace() function because it doesn't muck up the history list. YMMV. I've also found that using the following syntax creates headaches on certain 3.0 browsers:
 
<%
    response.redirect("javascript:framename.location.href='wherever';")
%>
 
 
So I would avoid using that one unless you're in a controlled environment or you've tested it across your target audience.
 
If it is a form you're submitting to, you can use the following:
 
    <form method="post" action="page.asp" target="framename">
 
 
 
And if you want to open a new window, you can use:
 
<%
    url = "http://wherever.com/
    response.write("<script>" & vbCrLf)
    response.write("window.open('" & url & "');" & vbCrLf)
    response.write("</script>")
%>


If you'll accept my comment.. give points to wee siong also since he first mentionned client side script

fetched from aspfaq
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now