problems getting & testing value from forms

admin

Administrator
Staff member
Hi,

I have an html page that asks for some input, does some calculations, and then prints some output. It works nicely as just plain html, but I want to convert it to xhtml in order to be able to show some nice mathml rendering. However, the conversion is causing trouble getting the value of input & testing it. Here's the piece I am having trouble with:


<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
"xhtml-math11-f.dtd"
[<!ENTITY mathml "http://www.w3.org/1998/Math/MathML">]>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Argh!!!!!!!!!</title>
<script language="javascript">
function check_delta()
{
var x=document.delta_form.Xdelta.value;
alert("The value of delta is: " + x);
}
</script>
</head>

<body>
<center>
<h1>Why won't this stupid thing work?</h1>
<form name="delta_form" >
Input a value for delta:
<input type="text" name="Xdelta" onchange="check_delta();" />
</form>
</center>
</body>

</html>


The line
var x=document.delta_form.Xdelta.value;
which works well as *.html, no longer works if I save the file with a *.xhtml extension. I never see the alert popping up to confirm the value entered, and the value entered disappears from the input box. If I replace this line with x=3, then the alert popup works.

So how do I access the value that was entered into the form?

A second question concerns how to test the value retrieved. The xml parser complains about lines like:
if (0<=y && y<=1) { /* stuff */ }
saying they are poorly formed. I know it's getting hung up on the angle brackets, because it accepts things like
if (0==y && y==1) { /* stuff that will now never happen */ }

So how do you do comparisons without angle brackets?

I am having these problems in Firefox 1.0.1, Mozilla 1.7.2, and Netscape 7.2,in both Windows XP & Fedora Core 3.

Sorry for such newbie type questions, and apologies if this should go in a different forum!
 
Back
Top