wjindra
asked on
Using javascript switch and need to use <ahref on actions
I am writting a large if / else tree in an existing website. My include libraries have to be put into the html program using a scripting language called SpeedScript. These includes bring in the login data that I am testing in my if tree. Instead of using the if/else I am trying a switch.
I need to know how to write this if/else tree / switch statement. I am brand new to Javascript. Here is the code I currently have that is not working. The actions are to open a customers indivitual Excel spreadsheet.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>eSales Center - Customer Links</TITLE>
<META HTTP-EQUIV="Cache-Control" CONTENT="No-Cache">
<META HTTP-EQUIV="Pragma" CONTENT="No-Cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
<SCRIPT LANGUAGE="SpeedScript">
{shared/esalesvars.i}
{shared/validate-session.i }
{shared/pp-global.i}
assign cLogin = if trim(cLogin) = "" then get-value("operinit") else cLogin.
</SCRIPT>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="javascript">
switch (cLogin)
{
case "12102":
<a href="/WI_testweb/12102.xl s"><b><fon t size="3">Matrix</font></b> </a><br />
break
case "134965":
<a href="/WI_testweb/12102.xl s"><b><fon t size="3">Matrix</font></b> </a><br />
break
case "13953":
<a href="/WI_testweb/12102.xl s"><b><fon t size="3">Matrix</font></b> </a><br />
break
case "13716":
<a href="/WI_testweb/13716.xl s"><b><fon t size="3">Matrix</font></b> </a><br />
break
case "111667":
<a href="/WI_testweb/111677.x ls"><b><fo nt size="3">Matrix</font></b> </a><br />
break
default:
window.alert("This account does not have a custom matrix");
}
</SCRIPT>
</BODY>
</HTML>
I need to know how to write this if/else tree / switch statement. I am brand new to Javascript. Here is the code I currently have that is not working. The actions are to open a customers indivitual Excel spreadsheet.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>eSales Center - Customer Links</TITLE>
<META HTTP-EQUIV="Cache-Control"
<META HTTP-EQUIV="Pragma" CONTENT="No-Cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
<SCRIPT LANGUAGE="SpeedScript">
{shared/esalesvars.i}
{shared/validate-session.i
{shared/pp-global.i}
assign cLogin = if trim(cLogin) = "" then get-value("operinit") else cLogin.
</SCRIPT>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="javascript">
switch (cLogin)
{
case "12102":
<a href="/WI_testweb/12102.xl
break
case "134965":
<a href="/WI_testweb/12102.xl
break
case "13953":
<a href="/WI_testweb/12102.xl
break
case "13716":
<a href="/WI_testweb/13716.xl
break
case "111667":
<a href="/WI_testweb/111677.x
break
default:
window.alert("This account does not have a custom matrix");
}
</SCRIPT>
</BODY>
</HTML>
ASKER
This did not work.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
OK good, I don't understood you want to put the right link in your page
The following open the excel file in a popup window
Open in new window