webMathematica >

HTML Formatting

Remember that if you want to return HTML that is not generated by the HTML package, you should construct your own string of HTML and return this as shown in the example below.

The HTML Functions

HTMLTableForm

In[1]:=
In[2]:=
Out[2]=
In[3]:=
Out[3]=
In[4]:=
Out[4]=

HTMLFormat

In[1]:=
In[2]:=
Out[2]=
In[3]:=
Out[3]=
In[4]:=
Out[4]=
In[5]:=
Out[5]=

HTMLSelect

In[1]:=
In[2]:=
Out[2]=
In[3]:=
Out[3]=
In[4]:=
Out[4]=
In[5]:=
Out[5]=
In[6]:=
Out[6]=
In[7]:=
Out[7]=

HTMLCheckbox

In[1]:=
In[2]:=
Out[2]=
In[3]:=
Out[3]=

webMathematica Examples

Table Formatting

<msp:evaluate> 
data = {{0.055, 90}, {0.091, 97}, {0.138, 107},
{0.167, 124}, {0.182, 142}, {0.211, 150},
{0.232, 172}, {0.248, 189}, {0.284, 209},
{0.351, 253}};
data = Map[# + {0, Random[Real, {-20, 20}]}&, data];
lm = LinearModelFit[data, {1, x^2}, x];
</msp:evaluate>

<msp:evaluate>
HTMLTableForm[MSPShow[ListPlot[data, Frame -> True, Axes -> False]],
TableHeadings -> {"Data to be fitted"},
TableAttributes -> {"cellpadding" -> "0", "cellspacing" -> "0"}
]
</msp:evaluate>

<msp:evaluate>
HTMLTableForm[
HTMLTableForm[lm["ParameterTableEntries"], TableAttributes -> {"cellpadding" -> "0", "cellspacing" -> "0"}],
TableAttributes -> {"cellpadding" -> "0", "cellspacing" -> "0"}, TableHeadings->{"ParameterTable"}
]
</msp:evaluate>

Select Formatting

<msp:evaluate>
days = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
day = Null;
If[MSPValueQ[$$daySelected],
dayPT = MSPToExpression[$$daySelected];
day = Part[days, dayPT]
];
</msp:evaluate>

<form action="Select.jsp" method="post">
<msp:evaluate>
HTMLSelect[days, daySelected, SelectedOptions -> day]
</msp:evaluate> <br/>
<input type="image" name="btnSubmit" src="../../Resources/Images/Buttons/evaluate.gif"/>
</form>

<msp:evaluate>
If[day =!= Null,
dayPT = Mod[dayPT + 1, 7, 1];
"The day after the day selected is " <> Part[days, dayPT] <> "."
]
</msp:evaluate>