ACC2000: How to Use a Command Button to Hide and Display a FrameID: Q232594
|
You can hide and display a frame by using a command button. This article shows you how to create script that hides and displays one frame within a frameset or an inline frame.
When you use frames to simulate a subform or subreport on a data access page, you may want to provide a command button that toggles whether the frame is visible or not.
For additional information about creating frames on a data access page, please see the following article in the Microsoft Knowledge Base:
Q232566 ACC2000: How to Simulate a Subform or Subreport on a Data Access Page
Command Button
----------------------
Id: cmdToggle
Inner Text: Hide Frame
<HTML>
<HEAD>
<TITLE>Test Page</TITLE>
</HEAD>
<FRAMESET ID="FSet" ROWS="50%, 50%">
<FRAME NAME="Top" SRC="dapOrdersFrameset.htm">
<FRAME NAME="Bottom">
</FRAMESET>
</HTML>
<SCRIPT LANGUAGE=vbscript FOR=MSODSC EVENT=Current(oEventInfo)>The oEventInfo parameter added above is used to return specific information about the event to the script. You must add this parameter, regardless of whether it will be used or not, because the script will fail without it.
<SCRIPT LANGUAGE=vbscript FOR=MSODSC EVENT=Current(para)>
<!--
dim Loc
dim Ser
Loc = "http://<ServerName>/<FolderName>/dapOrderDetails.htm?serverfilter="
Ser = chr(34) & "Orderid=" & orderid.value & chr(34)
Loc = Loc & Ser
window.frames("Bottom").location = Loc
-->
</SCRIPT>
<SCRIPT language=vbscript for=cmdToggle event=onclick>
<!--
Dim myFSet
Set myFSet = window.parent.document.all.item("FSet")
If myFSet.rows = "50%, 50%" Then
myFSet.rows = "100%"
document.all.item("cmdToggle").innertext="Show Frame"
Else
myFSet.rows = "50%, 50%"
document.all.item("cmdToggle").innertext="Hide Frame"
End If
-->
</SCRIPT>
<IFRAME ID="IFrm" HEIGHT="50%" WIDTH="80%"></IFRAME>
<SCRIPT LANGUAGE=vbscript FOR=MSODSC EVENT=Current(oEventInfo)>The oEventInfo parameter added above is used to return specific information about the event to the script. You must add this parameter, regardless of whether it will be used or not, because the script will fail without it.
<SCRIPT LANGUAGE=vbscript FOR=MSODSC EVENT=Current(para)>
<!--
dim Loc
dim Ser
Loc = "http://<ServerName>/<FolderName>/dapOrderDetails.htm?serverfilter="
Ser = chr(34) & "Orderid=" & orderid.value & chr(34)
Loc = Loc & Ser
window.frames("IFrm").location = Loc
-->
</SCRIPT>
<SCRIPT language=vbscript for=cmdToggle event=onclick>
<!--
Dim myIFrm
Set myIFrm = document.all.item("IFrm")
If myIFrm.style.visibility = "" Then
myIFrm.style.visibility = "hidden"
document.all.item("cmdToggle").innertext="Show Frame"
Else
myIFrm.style.visibility = ""
document.all.item("cmdToggle").innertext="Hide Frame"
End If
//-->
</SCRIPT>
Additional query words: subpage hide show
Keywords : AccDAP DAPScriptHowTo dtavbscript
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: July 13, 1999