Gavric
09-02-2005, 10:24 PM
I apologize if this is a bit general or high-level, but I'm stumped and don't know what to do. I've created a function that works fine under straight JavaScript, but fails when used in an ASP context.
I've researched JavaScript in ASP pages and the syntax seems to be correct. I don't know what to do to resolve this. I see an error in the JavaScript Console that tells me the "helpdesk" function is undefined.
I have four menu buttons that are keyed to execute this function onClick. Here's one example of a button:
<CODE><INPUT TYPE=image NAME="DBNHD" SRC="DBButton.jpg" BORDER=0 ONCLICK="helpdesk('DB')"></CODE>
The function, "helpdesk", is supposed to check the value of the menu button against switch cases and then adjust the look of the page depending on the group selected. "Helpdesk" also calls an "updates" function that hides or reveals Response.Write statements that display group-specific information.
The following scripting is defined in the header, and I am using a <%@ LANGUAGE="JavaScript"%> tag at the top of my code.
Help will be greatly appreciated.
<%
var menu;
var contract;
var DBConn = Server.CreateObject("ADODB.Connection");
DBConn.Open(Application("HDNewsConnStr"));
var UpdateRecord = Server.CreateObject("ADODB.Recordset");
var SQLQuery = "SELECT DBRecent.UserID, DBRecent.Subject, DBRecent.Update, DBRecent.Affected, DBRecent.Actions, DBRecent.Info, DBRecent.Date, DBRecent.Time FROM DBRecent;";
UpdateRecord.Open(SQLQuery, DBConn);
function helpdesk (group) {var archive;
var defmsg = document.getElementById("defdisplay");
var update = document.getElementById("updtdisplay");
if (menu != null && menu != "default") {menu.style.display = "none"};
switch (group) {case "DB":
contract = "DB";
menu = document.getElementById("DB");
archivet = "Dressbarn Archive";
break;
case "FAI":
menu = document.getElementById("FAI");
contract = "FAI";
archivet = "FAI Archive";
break;
case "FNC":
menu = document.getElementById("FNC");
contract = "FNC";
archivet = "FNC Archive";
break;
case "MIS":
menu = document.getElementById("MIS");
contract = "MIS";
archivet = "MIS Archive";
break};
if (menu != null && menu != "default") {menu.style.display = ""};
if (contract != null && contract != "default") {updates(true)}
else {updates(false)};
var archive = document.getElementById("archiveheader");
archive.childNodes[0].nodeValue = archivet};
function updates (state) {var defmsg = document.getElementById("defdisplay");
var update = document.getElementById("updtdisplay");
if (state == true) {defmsg.style.display = "none"; update.style.display = ""}
else {defmsg.style.display = "table-row"; update.style.display = "none"}}
%>
I've researched JavaScript in ASP pages and the syntax seems to be correct. I don't know what to do to resolve this. I see an error in the JavaScript Console that tells me the "helpdesk" function is undefined.
I have four menu buttons that are keyed to execute this function onClick. Here's one example of a button:
<CODE><INPUT TYPE=image NAME="DBNHD" SRC="DBButton.jpg" BORDER=0 ONCLICK="helpdesk('DB')"></CODE>
The function, "helpdesk", is supposed to check the value of the menu button against switch cases and then adjust the look of the page depending on the group selected. "Helpdesk" also calls an "updates" function that hides or reveals Response.Write statements that display group-specific information.
The following scripting is defined in the header, and I am using a <%@ LANGUAGE="JavaScript"%> tag at the top of my code.
Help will be greatly appreciated.
<%
var menu;
var contract;
var DBConn = Server.CreateObject("ADODB.Connection");
DBConn.Open(Application("HDNewsConnStr"));
var UpdateRecord = Server.CreateObject("ADODB.Recordset");
var SQLQuery = "SELECT DBRecent.UserID, DBRecent.Subject, DBRecent.Update, DBRecent.Affected, DBRecent.Actions, DBRecent.Info, DBRecent.Date, DBRecent.Time FROM DBRecent;";
UpdateRecord.Open(SQLQuery, DBConn);
function helpdesk (group) {var archive;
var defmsg = document.getElementById("defdisplay");
var update = document.getElementById("updtdisplay");
if (menu != null && menu != "default") {menu.style.display = "none"};
switch (group) {case "DB":
contract = "DB";
menu = document.getElementById("DB");
archivet = "Dressbarn Archive";
break;
case "FAI":
menu = document.getElementById("FAI");
contract = "FAI";
archivet = "FAI Archive";
break;
case "FNC":
menu = document.getElementById("FNC");
contract = "FNC";
archivet = "FNC Archive";
break;
case "MIS":
menu = document.getElementById("MIS");
contract = "MIS";
archivet = "MIS Archive";
break};
if (menu != null && menu != "default") {menu.style.display = ""};
if (contract != null && contract != "default") {updates(true)}
else {updates(false)};
var archive = document.getElementById("archiveheader");
archive.childNodes[0].nodeValue = archivet};
function updates (state) {var defmsg = document.getElementById("defdisplay");
var update = document.getElementById("updtdisplay");
if (state == true) {defmsg.style.display = "none"; update.style.display = ""}
else {defmsg.style.display = "table-row"; update.style.display = "none"}}
%>