rwarcup
08-09-2002, 05:06 PM
Hello,
I'm developing a RAG (Red/Amber/Green) status control. See code below.
I get an 'Error 'result_rag' is undefined when I include the '<IMG id=result_rag SRC="/images/green.gif" title="Green">' code inside <FORM></FORM> tags. When there are no <FORM> tags the code & control works ok.
Is this because I need to refer to the FORM object as part of the result_rag variable? How do I do this?
Any help would be appreciated.
Thanks in advance
Regards
Rob
<HTML>
<HEAD>
<title>RAG Status</title>
<script Language="JavaScript">
// build array
var List = new Array();
List[0] = new Array();
List[1] = new Array();
List[2] = new Array();
// Populate the array
List[0][0] = "Green";
List[0][1] = "/images/green.gif";
List[1][0] = "Amber";
List[1][1] = "/images/amber.gif";
List[2][0] = "Red";
List[2][1] = "/images/red.gif";
function call(rag){
comment1.innerText=List[rag][0];
result_rag.title=List[rag][0];
result_rag.src=List[rag][1];
}
</script>
</HEAD>
<BODY class=bdy>
<FORM NAME="aform" METHOD="POST" ACTION="store.asp">
<TABLE WIDTH="100%" BORDER="0" valign=top class=normaltext>
<tr valign="top">
<td width="20%">
<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=20 onclick="call(0)" style="CURSOR: hand" title="Red"><IMG SRC="/images/green.gif"></td>
<td width=20 onclick="call(1)" style="CURSOR: hand" title="Amber"><IMG SRC="/images/amber.gif"></td>
<td width=20 onclick="call(2)" style="CURSOR: hand" title="Green"><IMG SRC="/images/red.gif"></td>
<td width=20> </td>
<td width=20><IMG id=result_rag SRC="/images/green.gif" title="Green"></td>
</tr>
</table>
<span id="comment1">Green</span>
</td>
</tr>
</table>
</FORM>
</BODY>
</HTML>
I'm developing a RAG (Red/Amber/Green) status control. See code below.
I get an 'Error 'result_rag' is undefined when I include the '<IMG id=result_rag SRC="/images/green.gif" title="Green">' code inside <FORM></FORM> tags. When there are no <FORM> tags the code & control works ok.
Is this because I need to refer to the FORM object as part of the result_rag variable? How do I do this?
Any help would be appreciated.
Thanks in advance
Regards
Rob
<HTML>
<HEAD>
<title>RAG Status</title>
<script Language="JavaScript">
// build array
var List = new Array();
List[0] = new Array();
List[1] = new Array();
List[2] = new Array();
// Populate the array
List[0][0] = "Green";
List[0][1] = "/images/green.gif";
List[1][0] = "Amber";
List[1][1] = "/images/amber.gif";
List[2][0] = "Red";
List[2][1] = "/images/red.gif";
function call(rag){
comment1.innerText=List[rag][0];
result_rag.title=List[rag][0];
result_rag.src=List[rag][1];
}
</script>
</HEAD>
<BODY class=bdy>
<FORM NAME="aform" METHOD="POST" ACTION="store.asp">
<TABLE WIDTH="100%" BORDER="0" valign=top class=normaltext>
<tr valign="top">
<td width="20%">
<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=20 onclick="call(0)" style="CURSOR: hand" title="Red"><IMG SRC="/images/green.gif"></td>
<td width=20 onclick="call(1)" style="CURSOR: hand" title="Amber"><IMG SRC="/images/amber.gif"></td>
<td width=20 onclick="call(2)" style="CURSOR: hand" title="Green"><IMG SRC="/images/red.gif"></td>
<td width=20> </td>
<td width=20><IMG id=result_rag SRC="/images/green.gif" title="Green"></td>
</tr>
</table>
<span id="comment1">Green</span>
</td>
</tr>
</table>
</FORM>
</BODY>
</HTML>