Combine two javascript

This is a discussion on "Combine two javascript" within the JavaScript Forum section. This forum, and the thread "Combine two javascript are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jun 3rd, 2008, 10:59
Junior Member
Join Date: Jun 2008
Location: england
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Combine two javascript

Hi I am having problems with my js. The problem is that it just wont work any ideas? Please find below the code from the head.
Code: Select all
<head>
<title></title>
<meta content="en-gb" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link href="style.css" media="screen" rel="stylesheet" type="text/css" />
<link href="main%20nav/menu_style.css" rel="stylesheet" type="text/css" />
<link href="sdmenu/sdmenu.css" rel="stylesheet" type="text/css" />
<script src="mootools.js" type="text/javascript"></script>
<script src="slideshow.js" type="text/javascript"></script>
<script src="sdmenu/sdmenu.js" type="text/javascript">
  /***********************************************
  * Slashdot Menu script- By DimX
  * Submitted to Dynamic Drive DHTML code library: http://www.dynamicdrive.com
  * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
  ***********************************************/
 </script>
<script type="text/javascript">
 // <![CDATA[
 var myMenu;
 window.onload = function() {
  myMenu = new SDMenu("my_menu");
  myMenu.init();
 };
 // ]]>
 </script>
<script type="text/javascript">
{ myShow = new Slideshow('image', { type: 'fade', duration: [2000, 4000], images: ['header.jpg', 'School Site Photo May 06 Letterbox v2.jpg', 'hums2.JPG'], hu: 'images/' }); }
</script>
</head>

Last edited by CloudedVision; Jun 3rd, 2008 at 13:09. Reason: Code tags, please
Reply With Quote

  #2 (permalink)  
Old Jun 3rd, 2008, 13:11
CloudedVision's Avatar
Nerdy Moderator
Join Date: Feb 2008
Location: In My Own Little World
Age: 14
Posts: 1,229
Blog Entries: 9
Thanks: 2
Thanked 38 Times in 38 Posts
Re: Combine two javascript

"Just won't work" isn't detailed enough explanation. What's it supposed to do? What's not working? (All of it?) Does it not work in all browsers? Does it cause any errors, and if so, can you post the errors? You gotta give us a lot more info to help you work through this.
__________________
CloudedVision, WebForumz Moderator
Web Design And Development: Other Road Design | Problems with IE6?: KApp | My Blog: Only Nerds Allowed
Last Blog Entry: Hilarious Rapper (Jul 29th, 2008)
Reply With Quote
  #3 (permalink)  
Old Jun 3rd, 2008, 13:16
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,956
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Re: Combine two javascript

This is without doubt, almost certainly conflicting / incompatible scripts.

My guess is that you will need to start your bug-hunt by checking out al the window onload processes including any present in the body tag.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
Reply With Quote
  #4 (permalink)  
Old Jun 3rd, 2008, 13:37
Junior Member
Join Date: Jun 2008
Location: england
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Combine two javascript

Think I have found the problem but just dont know how to solve this. There is two scripts,

Code: Select all
<script src="sdmenu/sdmenu.js" type="text/javascript">
  /***********************************************
  * Slashdot Menu script- By DimX
  * Submitted to Dynamic Drive DHTML code library: http://www.dynamicdrive.com
  * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
  ***********************************************/
 </script>
<script type="text/javascript">
 // <![CDATA[
 var myMenu;
 window.onload = function() {
  myMenu = new SDMenu("my_menu");
  myMenu.init();
 };
 // ]]>
 </script>

Then



Code: Select all
<script type="text/javascript">
 window.onload = function() { myShow = new Slideshow('image', { type: 'fade', duration: [2000, 4000], images: ['hums.JPG', 'hums1.JPG', 'hums2.JPG'], hu: 'images/' }); }
</script>


I think this is due to as Rob said windows on load function. Thanks for all your help

Last edited by CloudedVision; Jun 3rd, 2008 at 22:53. Reason: Code tags
Reply With Quote
  #5 (permalink)  
Old Jun 3rd, 2008, 13:44
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,956
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Re: Combine two javascript

Try this:--

Code: Select all
<script src="sdmenu/sdmenu.js" type="text/javascript">
  /***********************************************
  * Slashdot Menu script- By DimX
  * Submitted to Dynamic Drive DHTML code library: http://www.dynamicdrive.com
  * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
  ***********************************************/
 </script>
<script type="text/javascript">
 // <![CDATA[
 var myMenu;
 window.onload = function() {
  myMenu = new SDMenu("my_menu");
  myMenu.init();
myShow = new Slideshow('image', { type: 'fade', duration: [2000, 4000], images: ['hums.JPG', 'hums1.JPG', 'hums2.JPG'], hu: 'images/' });
 };
 // ]]>
 </script>
Delete this:-
Code: Select all
<script type="text/javascript">
 window.onload = function() { myShow = new Slideshow('image', { type: 'fade', duration: [2000, 4000], images: ['hums.JPG', 'hums1.JPG', 'hums2.JPG'], hu: 'images/' }); }
</script>
This *should* help.

Remember to use [code]your code here[/code] <--- this format when posting code

Hope this helps.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
Reply With Quote
  #6 (permalink)  
Old Jun 3rd, 2008, 13:52
Junior Member
Join Date: Jun 2008
Location: england
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Re: Combine two javascript

It worked. Its taken me all day and its taken you 5 mins to sort it.

Thanks for all your help. Its the firt time I have used this site and its been excellet I am designing a school website. Thanks Rob
Reply With Quote
  #7 (permalink)  
Old Jun 3rd, 2008, 14:51
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,956
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Re: Combine two javascript

Most welcome

Be sure to tell all your web design friends

Feel free to post whenever you run into issues
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
Reply With Quote
Reply

Tags
java script

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
Date & Time [Combine] doctypedeclaration JavaScript Forum 3 Mar 12th, 2008 01:22
Coding help: Combine Insert into and If/else statement! skuliaxe PHP Forum 6 Jan 23rd, 2008 17:50
[SOLVED] combine 2 onlick events. AdRock JavaScript Forum 1 Oct 15th, 2007 06:03
what does + + mean in Javascript eg: var m = (A1+ +B4); Andy K JavaScript Forum 6 Dec 13th, 2006 23:57
How can I combine two columns into one column using SQL gecastill Databases 2 Jun 3rd, 2005 18:23


All times are GMT. The time now is 10:42.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43