Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<TITLE>Calculo de porcentaje </TITLE>
<META content="text/html; charset=windows-1251" http-equiv=Content-Type>
<meta name="DESCRIPTION"content="Rockzillla">
<meta name="KEYWORD"content="venezuela.">
</HEAD>
<BODY style="FONT-FAMILY: Arial" bottomMargin=0 vLink=#000000 aLink=#000000
link=#000000 bgColor=#ffffff leftMargin=0 topMargin=0 rightMargin=0 ? size="2"
face="arial" font>
<TABLE width=459 height="92" border=0 align=center cellPadding=0 cellSpacing=0>
<TBODY>
<TR bordercolor="#0099FF">
<TD width=459 align=left vAlign=top bordercolor="#FFFFFF"><TABLE cellSpacing=0 cellPadding=0 width=434 align=center border=0>
<TBODY>
<TR>
<TD valign="top">
<P align=center>
<SCRIPT language=JavaScript>
function perc1() {
a = document.form1.a.value/100;
b = a*40;
document.form1.total1.value = 40
}
function perc2() {
a = document.form1.c.value;
b = 40;
c = a/40;
d = c*100;
document.form1.total2.value = d
if (d <=45){ document.bgColor='red'}
else {
if (d <=75){ document.bgColor='yellow'}
else {
if (d <= 100){ document.bgColor='green'}
}
}
}
{
}
//-->
</SCRIPT>
<P align=center>
<FORM name=form1>
<TABLE width="510" height="100" border=1 cellPadding=1 cellSpacing=1>
<TBODY><TR>
<TD width="213" height="46"><font size="1">
<INPUT size=10 name=c>
porcentaje de 40 </font></TD>
<TD width="69"><font size="1">=
<INPUT size=10 name=total2>
%</font></TD>
<TD width="57"><font size="1">
<INPUT onclick=perc2() type=button value=Calculo>
</font></TD>
<TD width="95"><p><font size="-1"><table width="99" border="1">
<tr>
<td width="89" height="59" name=tabla perc2()><div name=tabla onclick=perc2() align="center" id="perc2()"></div></td>
</tr>
</table></font></p>
<TD align=middle
colSpan=4> <CENTER><table><td>
<div align="center"> <font size="1">
<INPUT type=reset value=Reset>
</font></div>
<P align=center> <font face="Arial, Helvetica, sans-serif" size="2">
</font><BR>
<BR>