D
duncan
As a newbie to Java I need a bit of help.
I have the line <A HREF=JavaScript:showPanel('tab3')> in the <body> of
my pages html which when the page does not call the identified
function. I have put alert statements in various places and the
ones in the called function does not appear.
The page is enbedded in a frameset.
The page itself came from the wrox book "Professional Javascript 2nd
Edition" which I want to adapt for a project I am developing.
What is the problem?
Thanks in advance
Duncan
The full code is
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="LeagueMaintenance.aspx.vb"
Inherits="CricketLeague.LeagueMaintenance"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>LeagueMaintenance</title>
<style>
<!-- #include file= "cricketleague.css" -->
div { display:none; }
</style>
<meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<script language="javascript">
function clearTabs()
{
alert ("cleartabs called")
var tabs = document.getElementsByName("tabBar").cells
for (var i=0; i < tabs.length i++)
{
tabs.className = "InactiveTab"
}
var contentDivs = document.getElementById('contentArea').getElementByTagName("div")
for (var i = 0; i < contentDivs.length; i++)
{
contentDivs.style.display = "none"
}
}
function showPanel(selectedTab)
{
alert ("showPanel called")
clearTabs()
var tabE1 = document.getElementById(selectedTab)
tabE1.className = "ActiveTab"
var con = tabE1.getAttribute('connect')
document.getElementById(con).style.display = "block"
}
</script>
</HEAD>
<body>
<script language="javascript">
alert("java ran")
alert("java ran again")
</script>
<table border="0" width="100%" cellpadding="1" cellspacing="0"
align="center">
<tr id="tabBar">
<th ID="tab1" connect="details" class="InactiveTab">
<A HREF="JavaScript:showPanel('tab1')">Details</A>
</th>
<th ID="tab2" connect="search" class="InactiveTab">
<A HREF="JavaScript:showPanel('tab2')">Search</A>
</th>
<th ID="tab3" connect="help" class="InactiveTab">
<A HREF="JavaScript:showPanel('tab3')">Help</A>
</th>
</tr>
<tr id="contentArea">
<td colspan="3">
<div id="details">
<h3>Details</h3>
Some information can be displayed here
</div>
<div id="search">
<h3>Search</h3>
<form>
<input type="text" name="querystring" size="30"> <input
type="submit" value="Search">
</form>
</div>
<div id="help">
<h3>help</h3>
<ol>
<li>
Click on the tab headings
<li>
Tab2 provides form to search
<li>
tab 3 is this page</li>
</ol>
</div>
</td>
</tr>
</table>
</body>
</HTML>
I have the line <A HREF=JavaScript:showPanel('tab3')> in the <body> of
my pages html which when the page does not call the identified
function. I have put alert statements in various places and the
ones in the called function does not appear.
The page is enbedded in a frameset.
The page itself came from the wrox book "Professional Javascript 2nd
Edition" which I want to adapt for a project I am developing.
What is the problem?
Thanks in advance
Duncan
The full code is
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="LeagueMaintenance.aspx.vb"
Inherits="CricketLeague.LeagueMaintenance"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>LeagueMaintenance</title>
<style>
<!-- #include file= "cricketleague.css" -->
div { display:none; }
</style>
<meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<script language="javascript">
function clearTabs()
{
alert ("cleartabs called")
var tabs = document.getElementsByName("tabBar").cells
for (var i=0; i < tabs.length i++)
{
tabs.className = "InactiveTab"
}
var contentDivs = document.getElementById('contentArea').getElementByTagName("div")
for (var i = 0; i < contentDivs.length; i++)
{
contentDivs.style.display = "none"
}
}
function showPanel(selectedTab)
{
alert ("showPanel called")
clearTabs()
var tabE1 = document.getElementById(selectedTab)
tabE1.className = "ActiveTab"
var con = tabE1.getAttribute('connect')
document.getElementById(con).style.display = "block"
}
</script>
</HEAD>
<body>
<script language="javascript">
alert("java ran")
alert("java ran again")
</script>
<table border="0" width="100%" cellpadding="1" cellspacing="0"
align="center">
<tr id="tabBar">
<th ID="tab1" connect="details" class="InactiveTab">
<A HREF="JavaScript:showPanel('tab1')">Details</A>
</th>
<th ID="tab2" connect="search" class="InactiveTab">
<A HREF="JavaScript:showPanel('tab2')">Search</A>
</th>
<th ID="tab3" connect="help" class="InactiveTab">
<A HREF="JavaScript:showPanel('tab3')">Help</A>
</th>
</tr>
<tr id="contentArea">
<td colspan="3">
<div id="details">
<h3>Details</h3>
Some information can be displayed here
</div>
<div id="search">
<h3>Search</h3>
<form>
<input type="text" name="querystring" size="30"> <input
type="submit" value="Search">
</form>
</div>
<div id="help">
<h3>help</h3>
<ol>
<li>
Click on the tab headings
<li>
Tab2 provides form to search
<li>
tab 3 is this page</li>
</ol>
</div>
</td>
</tr>
</table>
</body>
</HTML>