iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > JavaScript

Reply
 
LinkBack Thread Tools
Old August 11th, 2009, 05:57 PM   #1
New Member
 

Join Date: Aug 2009
Location: United States
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 hananah is on a distinguished road
Javascript code not working on Firefox?

I have multiple rollovers and onclick commands using "function". They all work on Safari, but one of the functions doesn't work on Firefox.

-------------Here's the javascript:-------------
function list1() { if
(this.document.all.list1.style.display=="none")
(this.document.all.list1.style.display="block") ;
else (this.document.all.list1.style.display="none") ; }
--------------------------------------…

-------------and the HTML that calls this function-------------
<a href="javascript:chng('img1'); showOne2('photo1'); list1();">
Test Link</a>
----------------

To see the live page, here's my little tester spot i set up:
www.hanananah.com/brimin/index.php -- click "Design Live" - thats where I'm having the difficulty.

When you click anything of the list items (w/ the green arrows), content is supposed to show up under it, then disappear if u click it again. It works in Safari, but not in Firefox.

Any help is appreciated -- THANK YOU!
hananah is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old August 28th, 2009, 11:41 PM   #2
New Member
 

Join Date: Jun 2007
Location: England
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Captain Logical is on a distinguished road
Re: Javascript code not working on Firefox?

document.all is non-standard, use document.getElementById instead.
Instead of multiple functions, you should have only one function to which you pass a parameter:
Code:
function list( n ) 
{
 var elem =  document.getElementById("list" + n );
 elem.style.display =  (elem.style.display == 'block' ? 'none' : 'block' );
}
//to toggle "list1" use: list(1);
Also your links would be better using this format:
Code:
<a href="#" onclick="chng('img1'); showOne2('photo1'); list(1); return false">
Test Link</a>
Captain Logical is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks

Tags
firefox , function , javascript


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript Text Fader Not working in Firefox kwal JavaScript 0 October 1st, 2008 08:22 PM
Some javascript not working in Firefox jonnymorris HTML, XHTML and CSS 4 September 18th, 2007 11:02 AM
Some javascript not working in Firefox jonnymorris JavaScript 4 September 18th, 2007 07:47 AM
javascript working fine in IE but cannot work in Firefox web20tester JavaScript 0 May 21st, 2007 02:37 PM
Code not working on firefox acidblue0 HTML, XHTML and CSS 3 January 2nd, 2006 05:14 PM


Search Engine Optimization by vBSEO 3.2.0 RC8