mainmenu.aspxReturn to the Documentation page

‘All the .aspx files are written in VB.Net.’


<%@ Page Language="VB" %>

‘Register a custom control which is called counter.ascx – it keeps track of visitors to the mainmenu page. The TagPrefix=’asp101’ is used by an asp tag further down.’

<%@ Register TagPrefix="asp101" TagName="Counter" Src="./otherfiles/counter.ascx" %>



<title>Welcome to the election 2001 database</title>

td.a {border-left:blue 4px solid}


‘A script runs when the page is loaded to check what the client screen resolution is – loads a different graphic file depending on the answer. In addition the element [tablemenu] has its fontsize increased to 'medium' if the screen width is over 1250 pixels and, if the browser recognises the syntax 'self.innerHeight && !window.opera', the first stylesheet will have the td font-size set to 'large' - the insertRule method is only recognized by Firefox, Mozilla, Opera 9.0 etc and not by IE or earlier versions of Opera.’

<script language="Javascript">

function init() {

if (window.screen.width > 1250 ) {

document.getElementById("body1").style.background = "url(./images/houseofcommons1280.jpg)";

document.getElementById("tablemenu").style.fontSize = "medium";

if (self.innerHeight && !window.opera) {document.styleSheets[0].insertRule("td {font-size: large}",0);}


else {

if (window.screen.width > 1000 ) {

document.getElementById("body1").style.background = "url(./images/houseofcommons1024.jpg)";


else {

document.getElementById("body1").style.background = "url(./images/houseofcommons800.jpg)";




‘Two functions deal with the hiding and unhiding of the main menu to allow the full viewing of the House of Commons background graphic. These functions are attached to the span tags shown below - [unhidemenu & hidemenu].’

function doHide() {

document.getElementById("tablemenu").style.visibility = "hidden";

document.getElementById("unhidemenu").style.visibility = "visible";


function doUnhide() {

document.getElementById("tablemenu").style.visibility = "visible";

document.getElementById("unhidemenu").style.visibility = "hidden";




‘The onload event triggers the running of the init function mentioned above.’

<body id="body1" onload="init()" title="The House of Commons in 1834">

<br><span id="unhidemenu" onClick="doUnhide()" style="visibility:hidden;cursor:pointer;color:blue;background-color:white" title="Click to show the menu again"> <u>Show menu</u> </span>



‘Simple table to put all the first-level menu options in.’

<table cellspacing="0" cellpadding="5" style="border: double 4px blue;background: white" id="tablemenu" >

<tr><td style="border-bottom: solid blue 4px;font-size:x-large;font-family:arial">Election 2001<td align="right" style="border-bottom: solid blue 4px"><span id="hidemenu" onClick="doHide()" style="color:blue;cursor:pointer;font-size:small" title="Click to hide the menu"> <u>Hide menu</u> </span></td></tr>


<td><a href="displayMPs.aspx">Display the data</a></td>

<td class="a"><a href="javascript:alert('Sorry you cannot add a record - the Election database is complete.')">Add a record</a> to the database</td>



<td><a href="searchforanMP.aspx">Search for an MP</a></td>

<td class="a"><a href="javascript:alert('Sorry you cannot update a record.')">Update a record</a> in the database</td>



<td><a href="searchforaConstituency.aspx">Search for a Constituency</a></td>

<td class="a"><a href="javascript:alert('Sorry you cannot delete a record.')">Delete a record</a> from the database</td>



<td><a href="byelections.aspx">By-elections</a></td>

<td class="a"><a href="javascript:var'electionmaps.htm', 'MyWindow', 'fullscreen=yes,scrollbars')">Election maps</a></td>



<td><a href="otherstats.aspx">Other statistics</a></td>

<td class="a"><a href="./otherfiles/documentation.aspx">Documentation</a></td>




‘The ascx custom control is called here using the TagPrefix ‘asp101:Counter’. It keeps track of the visitors by using a text file called mainmenu.aspx.cnt’


<td style="border-top: solid blue 4px"><font size=2><i>Webmaster:</i></font></td><td align="right" style="border-top: solid blue 4px"><font size=2><i>Visitors: <asp101:Counter id="ctrlHitCounterText" runat="server" Display = "text" /></i></font></td>