View Full Version : Simple Javascript not working in firefox.

05-31-2012, 09:06 AM
Its been some while since I used javascript and even when I used to use it I was wasn't very good at it.

Can you tell me what is wrong with this script and how to get it working in firefox, there is more to the code but it manly these if statements repeating it self, I am think the code isn't valid or something.

function run() {
document.form1.RunnungT.value = "0"
var Total = 0;
document.all.testtext.innerHTML = "";

document.all.testtext.innerHTML = "<ul><b><u>Items Selected</u></b>";

if (document.form1.Thredbo.checked)
if (document.form1.J8.checked)
Total = Total + 469;
document.form1.RunnungT.value = Total;
document.all.testtext.innerHTML = document.all.testtext.innerHTML + "<li>Thredbo July 8th - 11th (Four days)</li>";
if (document.form1.J86.checked)
Total = Total + 669;
document.form1.RunnungT.value = Total;
document.all.testtext.innerHTML = document.all.testtext.innerHTML + "<li>Thredbo June 8th - 13th (Six days)</li>";


document.all.testtext.innerHTML = document.all.testtext.innerHTML + "</ul>";

05-31-2012, 09:28 AM
Get rid of the document.all calls that were for Internet Explorer 4 and replace them with document.getElementById() which works in all browsers that have been released in the last 10 years including IE5+, Firefox 0.1+ etc

05-31-2012, 09:36 AM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

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



<div id="testtext" ></div>
<script type="text/javascript">
document.getElementById('testtext').innerHTML='use document.getElementById';