Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-31-2012, 09:06 AM   PM User | #1
james13009
New to the CF scene

 
Join Date: Jun 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
james13009 is an unknown quantity at this point
Cool Simple Javascript not working in firefox.

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.


Code:
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>"; 
}
</script>
james13009 is offline   Reply With Quote
Old 05-31-2012, 09:28 AM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,529
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
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
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 05-31-2012, 09:36 AM   PM User | #3
vwphillips
Senior Coder

 
Join Date: Mar 2005
Location: Portsmouth UK
Posts: 4,379
Thanks: 3
Thanked 466 Times in 453 Posts
vwphillips is a jewel in the roughvwphillips is a jewel in the roughvwphillips is a jewel in the rough
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

<head>
  <title></title>
</head>

<body>

<div id="testtext" ></div>
<script  type="text/javascript">
/*<![CDATA[*/
document.getElementById('testtext').innerHTML='use  document.getElementById';
/*]]>*/
</script>
</body>

</html>
__________________
Vic

God Loves You and will never love you less.

http://www.vicsjavascripts.org.uk/

If my post has been useful please donate to http://www.operationsmile.org.uk/
vwphillips is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:18 PM.


Advertisement
Log in to turn off these ads.