Click to See Complete Forum and Search --> : im a jscript noob in need of basic help


serAph1m
07-10-2003, 03:24 PM
I have the following at the top of my page:

<script language="Javascript">

var TCOLOR = "#B0FF80";
var BCOLOR = "#FFFFFF";

function SWAP()
{
var TEMP = "";
TEMP = TCOLOR;
TCOLOR = BCOLOR;
BCOLOR = TEMP;
}

function write.T()
{
document.write(TCOLOR);
}

function write.B()
{
document.write(BCOLOR);
}

</script>

and here's where the action comes into play:


<logic:iterate id="aListDefinitionRow" name="campaignListDefinitions">

<%/* if (SWAP)
{
TCOLOR = "#B0FF80";
BCOLOR = "#FFFFFF";
}
else
{
BCOLOR = "#B0FF80";
TCOLOR = "#FFFFFF";
}*/%>

<tr class="tableinner">
<td align="left" bgcolor=write.B();><font face="Arial" color=write.T();><bean.write name="aListDefinitionRow" property="Id"/></font></td>
<td align="left" bgcolor=write.B();><font face="Arial" color=write.T();><bean.write name="aListDefinitionRow" property="Label"/></font></td>
<td align="left" bgcolor=write.B();><font face="Arial" color=write.T();><bean.write name="aListDefinitionRow" property="Owner"/></font></td>
<td align="left" bgcolor=write.B();><font face="Arial" color=write.T();><bean.write name="aListDefinitionRow" property="Status"/></font></td>
<td align="left" bgcolor=write.B();><font face="Arial" color=write.T();><bean.write name="aListDefinitionRow" property="Description"/></font></td>
<td align="left" bgcolor=write.B(); colspan="2"><font face="Arial" color=write.T()><html:link paramName="aListDefinitionRow" paramProperty="id" paramId="id" page="/listManagement.do?action=edit" >Edit</html:link></font>
<font face="Arial"> / <html:link paramName="aListDefinitionRow" paramProperty="id" paramId="id" page="/listManagement.do?action=delete" >Delete</html:link></font></td></tr><td></td>

<script>
SWAP();
</script>

</logic:iterate>


(for those of you that arent familiar with the "logic" and "bean" things, theu're JSP (struts) tags - the code loops between the iterate statements.)


Im assuming Im commiting an ill-experienced syntax error - could you guys help me out? thx!
~ Rory K

gil davis
07-11-2003, 07:34 AM
<td align="left" bgcolor=write.B();><font face="Arial" color=write.T();><bean.write name="aListDefinitionRow" property="Id"/></font></td>
You cannot mix script and HTML in this way. All scripting in client-side HTML must occur within SCRIPT tags, and no HTML is allowed within a SCRIPT tag unless it is a literal value.

serAph1m
07-11-2003, 10:05 AM
Originally posted by gil davis
You cannot mix script and HTML in this way. All scripting in client-side HTML must occur within SCRIPT tags, and no HTML is allowed within a SCRIPT tag unless it is a literal value.

...so I need to have the write.T() and write.B() functions write the html too? I'll give that a try.

Heh - I thought the problem was me doing something retarded :D thx for confirming ;)