Current location: Hot Scripts Forums » General Web Coding » JavaScript » onLoad two functions, can't seem to get it to work


onLoad two functions, can't seem to get it to work

Reply
  #1 (permalink)  
Old 08-18-09, 04:17 PM
bluedogsb bluedogsb is offline
Newbie Coder
 
Join Date: Jan 2009
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
onLoad two functions, can't seem to get it to work

I have two onclick links that display a set of images, but I can only get one function to work. I know this is really simple but for some reason I can't figure it out how to make it work.

Code:
<body onLoad="resettoggle()">

<script type="text/javascript">
	<!--
	function resettoggle() {
		var e = document.getElementById('Trespa');
		e.style.display = 'none';
		}

        function resettoggle() {
		var e = document.getElementById('Kawneer');
		e.style.display = 'none';
		}
		
	function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }
	-->
	</script>
Obviously the functions are named the same, but even after changing them only one of the functions actually works. I fiddled with it for a while but with no luck. Any help?
Reply With Quote
  #2 (permalink)  
Old 08-24-09, 09:45 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
You could use

HTML Code:
style="display:none" 
on the element.

Also - try using onload instead of onLoad.

Having two functions with the same name will replace the first with the second.
Reply With Quote
  #3 (permalink)  
Old 08-25-09, 01:10 PM
bluedogsb bluedogsb is offline
Newbie Coder
 
Join Date: Jan 2009
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
I ended up figuring it out. Just renamed the functions and redid onload.
Reply With Quote
Reply

Bookmarks


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

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Consulting Firm Now Hiring Programmers, Analysts, and Engineers to Work From Home rdprogrammer Job Offers & Assistance 2 08-02-05 03:24 PM
Hiring - piece work $$$ mastamindz Job Offers & Assistance 7 07-12-05 08:45 PM
PHP Developer Required Olate Job Offers & Assistance 0 04-29-05 02:23 AM
Programer needed to work on PHP-nuke+wap NewTonez Job Offers & Assistance 4 08-12-04 07:21 AM
Web Designer/Programmer - Looking for work Lost Job Offers & Assistance 7 06-01-04 10:06 PM


All times are GMT -5. The time now is 01:54 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.