...

View Full Version : help me fix this



newathisbutbetr
06-28-2006, 05:02 PM
i have written a little bit of code for a personal site nothing important or great.
its a piece of code for a small online game.
but for some reason when you put in the 2 numbers in the two boxes and click calculate nothing happens. what am i doing wrong here.
hopefully its just a little bit of code so i dont have to try to rewrite the whole thing differently.
oh ya im kinda of a newbie lol
thanks

heres the code

<html>
<head>
<title>multiples</title>
<script type = "text/javascript">
<!--
function testmult()
{
var num1, num2, result;
num1 = parseint( documents.myform.num1.value);
num2 = parseint( document.myform.num2.value);

if ( multiple(num1, num2))
document.myform.result.value =
num1 + " is a multiple of " + num2;
else
document.myform.result.value =
num1 + "is not a multiple of " + num2;
}
function multiple( var num1, var num2)
{
if (( num1 % num2)== 0)
return true;
else;
return false;
}
//-->
</script>
</head>
<body>
<form name ="form1" action = "">
<table border ="1">
<tr><td> first</td>
<td><input name ="num1" type = "text" /></td>
</tr>
<tr><td>second</td>
<td><input name ="num1" type = "text"/>
</tr>
<tr><td>result</td>
<td><input name = "result" type = "text"/>
</td>
</tr>
<tr><td>
<input type = "button" value = "calculate"
onclick = "testmult()"/></td>
</tr>
</table>
</form>
</html>

thank you for trying to help me .

newathisbutbetr
06-28-2006, 05:16 PM
i thought its probably not that big of a problem that a software debugger or somethign could pick it up
i heard html kit tidy. would that pick it up.?
is there anyother ones that you could tell me about.?

arnyinc
06-28-2006, 06:54 PM
Mostly just typos...



<html>
<head>
<title>multiples</title>
<script type = "text/javascript">
<!--
function testmult()
{
var num1, num2, result;
num1 = parseInt( document.form1.num1.value);
num2 = parseInt( document.form1.num2.value);

if ( multiple(num1, num2))
document.form1.result.value = num1 + " is a multiple of " + num2;
else
document.form1.result.value = num1 + " is not a multiple of " + num2;
}

function multiple( num1, num2)
{
if (( num1 % num2)== 0)
return true;
else
return false;
}

//-->
</script>
</head>
<body>
<form name ="form1" action = "">
<table border ="1">
<tr><td> first</td>
<td><input name ="num1" type = "text" /></td>
</tr>
<tr><td>second</td>
<td><input name ="num2" type = "text"/>
</tr>
<tr><td>result</td>
<td><input name = "result" type = "text"/>
</td>
</tr>
<tr><td>
<input type = "button" value = "calculate" onclick = "testmult()"/></td>
</tr>
</table>
</form>
</html>

newathisbutbetr
06-28-2006, 07:15 PM
oh man thank you so much. i was starting to worry about myself. lol

and by the way any one can answer this how did you do that when you posted the code. that is so much easier to read. that way

again thanks i see where i was messing up.

newathisbutbetr
06-28-2006, 07:40 PM
man this site is an awsome site.
who needs to go to school when you have awsome teachers on here.
and on top of that you help others for free.
i can see myself becoming an cfaddict like arnyinc.
well let me go see if i can help others on here too:):)
ill definetly post a link to this site on my page.. for shure.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum