-
JavaScript Help Needed - How to Show Layers
I am a VB programmer by trade but I've been asked to write a simple DRG calculator in ASP that will work on a variety of browsers. I used Dreamweaver to start so most of my scripts work fine, however, on one page (jCalc.asp) I have three buttons that peform some special functions:
1) Show Calculations - make a layer (layerCalculations) visible that shows the details behind the complex calculations
2) Show Variables - make a layer (layerVariables) visible that shows the variables, their English names and their current values
3) New Calculation - returns user to entry screen
Button #3 works fine. Buttons 1 and 2 do nothing. I added an alert in my function to confirm that I was actually hitting the function which I was - so I know it must be the syntax I am using.
I've tried at least 6 variations in code with the same result. I need a JavaScript soul to tell me what I'm doing wrong!
Here is the code behind my page:
=======================================
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<%
function formatAsMoney(mnt)
{
mnt -= 0;
mnt = (Math.round(mnt*100))/100;
return (mnt == Math.floor(mnt)) ? mnt + '.00'
: ( (mnt*10 == Math.floor(mnt*10)) ?
mnt + '0' : mnt);
}
%>
<%
// Perform calculations
var LRSA = (rsVariables.Fields.Item("LRSA").Value);
var NLRSA = (rsVariables.Fields.Item("NLRSA").Value);
var WageIndex = (rsVariables.Fields.Item("WAGE_INDEX").Value);
var COLA = (rsVariables.Fields.Item("COLA").Value);
var SFCR = (rsVariables.Fields.Item("SFCR").Value);
var LUAO = (rsVariables.Fields.Item("LUAO").Value);
var GAF = (rsVariables.Fields.Item("WICGRN").Value);
var CAPCOLA = (rsVariables.Fields.Item("COLACP").Value);
var CAPDSH = (rsVariables.Fields.Item("DSHCPG").Value);
var CAPIME = (rsVariables.Fields.Item("TCHCP").Value);
var OPRDSH = (rsVariables.Fields.Item("DSHOPG").Value);
var OPRIME = (rsVariables.Fields.Item("TCHOP").Value);
// Perform TOTAL calculations
var TOP = formatAsMoney(((LRSA * WageIndex) + (NLRSA * COLA)) * DRGWeight * (1 + OPRDSH + OPRIME));
var TCP = formatAsMoney((SFCR * DRGWeight * GAF * LUAO * CAPCOLA) * (1 + CAPDSH + CAPIME));
var TDP = formatAsMoney((((LRSA * WageIndex) + (NLRSA * COLA)) * DRGWeight * (1 + OPRDSH + OPRIME)) + ((SFCR * DRGWeight * GAF * LUAO * CAPCOLA) * (1 + CAPDSH + CAPIME)));
%>
<html>
<head>
<!--
window.location="http://www.presscott.com/stryker/jEnter.asp";
//-->
<script language="JavaScript">
<!--
function changeObjectVisibility(objectId, newVisibility)
{
var styleObject = getStyleObject(objectId);
if(styleObject)
{
document.layers(objectId).style.visibility = newVisibility;
//styleObject.style.visibility = newVisibility;
return true;
} else {
return false;
//alert("Unable to set visibility!")
}
}
//-->
</script>
<title>2006 Medicare IPPS Pricing Tool</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="post" action="">
<!-- some code omitted to allow post -->
<tr bgcolor="#000000">
<td colspan="3" align="center"> <font color="#000066">
<input type="button" name="btnShowCalculations" value="Show Calculations" style="width: 150px; font-family: verdana; size: 8px;" onClick="changeObjectVisibility('layerCalculations','visible');">
<input type="button" name="btnShowVariables" value="Show Variables" style="width: 150px; font-family: verdana; size: 8px;" onClick="changeObjectVisibility('layerVariables','visible');">
<input type="button" name="btnNewCalc" value="New Calculation" style="width: 150px; font-family: verdana; size: 8px;" onClick="window.location='http://www.presscott.com/stryker/jEnter.asp'"> </font></td>
</tr>
<tr>
<td colspan="3" bgcolor="#FFFFFF"><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#000066">NOTES:
DRG reimbursement amounts assume the following: Inlier rate, non-HMO beneficiary,
no transfers, and no new technology pass-thru.</font></td>
</tr>
</table>
</form>
<br>
<div id="layerCalculations" style="position:absolute; width:844px; height:316px; z-index:2; left: 13px; top: 321px; visibility: hidden;">
<!-- body of DIV omitted to allow post --> </div>
<div id="layerVariables" style="position:absolute; width:758px; height:268px; z-index:1; left: 15px; top: 565px; visibility: hidden;">
<!-- body of DIV omitted to allow post -->
</div>
</body>
</html>
<%
rsDRG.Close();
%>
<%
rsVariables.Close();
%>
======================================
Your help is greatly appreciated!
Kevin
Last edited by kglazebrook; 08-29-2005 at 03:41 PM.
Reason: odified title to be more descriptive
Similar Threads
-
Replies: 5
Last Post: 05-06-2006, 10:22 PM
-
By Keith Sarver in forum Web
Replies: 0
Last Post: 12-14-2002, 02:18 PM
-
Replies: 1
Last Post: 01-08-2002, 02:48 PM
-
Replies: 2
Last Post: 03-24-2001, 09:39 AM
-
By Murray Foxcroft in forum Web
Replies: 5
Last Post: 11-02-2000, 02:42 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks