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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

link to close self then refresh other page.... 1

Status
Not open for further replies.

thompom

Technical User
Dec 4, 2006
395
GB
hi,

a user clicks a search button that, if there are criteria matches, opens another window that displays the matches.

next to each match is a link...

Code:
<a href=<%Response.Write refrer & "?cusid=" & Server.URLEncode(x_cusid)& "&carid=" & Server.URLEncode(x_carid)& "&bookst=" & Server.URLEncode(x_bookst)& "&bookend=" & Server.URLEncode(x_bookend) & "&motid=" & Server.URLEncode(x_motid)& "&motdate=" & Server.URLEncode(x_datetxt)& "&x_stockreg=" & Server.URLEncode(x_stockreg) & "&x_stockmakeid=" & Server.URLEncode(x_stockmakeid) & "&x_stockmodid=" & Server.URLEncode(x_stockmodid) & "&franid=" & Server.URLEncode(x_franid)%> target="_blank"><img src="images/gotobut.gif" width="37" height="14" border="0"></a>

this works fine except i would like the link to close the current 'search' window and refresh the parent window with the link above

thanks MG
 
something like this should work, or at least get you started:
Code:
<script type="text/javascript">

function doIt() {
   opener.window.refresh();
   window.close();
}

</script>

-kaht

[small](All puppies have now found loving homes, thanks for all who showed interest)[/small]
 
kaht - thanks for your reply
i use a similar function to refresh the previous screen
which is fantastic,
Code:
<script language="JavaScript">
		opener.location.reload(true);
		self.close();
</script>

however when the reload of the previos page happens
is it possible to add this to the querystring?

"&motdate=" & Server.URLEncode(x_datetxt)
 
Try this:
Code:
<script language="JavaScript">
        opener.location = opener.location + "&motdate=" + <%=Server.URLEncode(x_datetxt)%>
        self.close();
</script>

-kaht

[small](All puppies have now found loving homes, thanks for all who showed interest)[/small]
 
thanks - that works great apart from in the querystring
x_datetxt is shown as undefined

eg

have written that variable to the page and it shows as
22/01/2007

do i need to request it before running this function?

thanks again

Code:
<script type="text/javascript">
function reload(){
        opener.location = opener.location + "&motdate=" + <%=Server.URLEncode(x_datetxt)%>
        self.close();
		}
</script>
<img src="images/gotobut.gif" width="37" height="14" border="0" onclick="reload()" />
 
Your ASP command Server.URLEncode(x_datetxt) is returning undefined. It's probably best to redirect this question to the ASP forum now, as they will likely be able to give you the rest of the solution.

forum333

-kaht

[small](All puppies have now found loving homes, thanks for all who showed interest)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top