SUBROUTINE DIV_S
* Demonstrate the use of the ID parameter with the RWS_DIV subroutine.
* The ID is used to identify the dovision, so that it can be displayed
* or hidden when the user clicks a button.
* Include the RealWeb definitions
INCLUDE #RW.INCLUDE.DEFS FROM /SYSFILES/REALWEB,BP
* Start the HTML page.
CALL RW_START_HTML_PAGE("Division Example 2", "", "", "", "")
HTML = ""
* Insert a level 1 heading.
TEXT = "Overview"
CALL RWS_HEADING(TEXT, 1, 'style="color: purple"')
HTML = HTML : TEXT
* Insert a paragraph containing some text.
TEXT = "Reality is a software environment that supports Reality " : ...
"applications on UNIX and Windows (NT, 2000 and XP) systems. The " : ...
"applications support environment supplied by Reality is a Relational " : ...
"Database Management System (RDBMS), supporting multiple databases on " : ...
"a single host platform, a range of powerful utilities for database " : ...
"management and inquiry, and a set of utilities for operating system " : ...
"resources."
CALL RWS_PARA(TEXT, "", "")
HTML = HTML : TEXT
* Define a button that will allow the user to show or hide the
* contents of a division.
* The button will call a JavaScript function that requires two
* parameters: a reference to the button and the id of the division
* to be shown or hidden.
BUTTON = ""
CALL RWA_BUTTON(BUTTON, "", "More", "showMore(this, 'More');", "")
CALL RWS_PARA(BUTTON, "", "") ;* Put the button in its own paragraph.
HTML = HTML : BUTTON
* Define a variable to hold the division.
DIV = ""
* Insert a level 2 heading.
TEXT = "Multiple Databases"
CALL RWS_HEADING(TEXT, 2, "")
DIV = DIV : TEXT
* Insert a paragraph containing some text.
TEXT = "Any number of databases can be created and maintained on the host. " : ...
"The only restriction is disk space availability. This allows " : ...
"independent and secure use of different databases by different " : ...
"departments or groups using the system. Each database comprises a " : ...
"collection of data organised in relational data structures enabling " : ...
"easy access to, and manipulation of data."
CALL RWS_PARA(TEXT, "", "")
DIV = DIV : TEXT
* Enclose the heading and paragraph in a division.
* Hide the division, and give it a background colour and a border.
aClass = 'style="visibility: hidden; ' : ...
'background-color: burlywood; ' : ...
'border: thin inset firebrick; ' : ...
'padding: 10px;"'
CALL RWS_DIV(DIV, "More", aClass)
HTML = HTML : DIV
* Output the HTML.
CALL RW_PUT(HTML)
* Get the JavaScript code and put it in the JavaScript buffer.
CALL RW_INSERT_ITEM("REALWEB-ITEMS", "showMore.js", RWD_JAVASCRIPT)
* Complete the page.
CALL RW_END_PAGE
RETURN

Click the button to see the effect.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="Reality">
<TITLE>Division Example 2</TITLE>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
function showMore(btn, id) {
var el = (document.getElementById ? document.getElementById(id) : document.all[id]);
if (el.style.visibility == 'hidden') {
el.style.visibility = 'visible';
btn.value = 'Less';
}
else {
el.style.visibility = 'hidden';
btn.value = 'More';
}
}
</SCRIPT>
</HEAD>
<BODY>
<H1 style="color: purple">
Overview
</H1>
<P>
Reality is a software environment that supports Reality applications on UNIX and Windows (NT, 2000 and XP) systems. The applications support environment supplied by Reality is a Relational Database Management System (RDBMS), supporting multiple databases on a single host platform, a range of powerful utilities for database management and inquiry, and a set of utilities for operating system resources.
</P>
<P>
<INPUT TYPE=BUTTON VALUE="More" OnClick="showMore(this, 'More');">
</P>
<DIV style="visibility: hidden; background-color: burlywood; border: thin inset firebrick; padding: 10px;" ID="More">
<H2>
Multiple Databases
</H2>
<P>
Any number of databases can be created and maintained on the host. The only restriction is disk space availability. This allows independent and secure use of different databases by different departments or groups using the system. Each database comprises a collection of data organised in relational data structures enabling easy access to, and manipulation of data.
</P>
</DIV>
</BODY>
</HTML>