Hey guys I'm having a bit of trouble running two scripts on the same webpage, one is for the top slider and the other is for a contact form, I been looking around trying to find how to combine them but I cant seem to find anything. Here is my code I need to combine: <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="js/jquery.cycle.all.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#slideshow').cycle({ fx: 'fade', speed: 'slow', timeout: 2600, pager: '#slider_nav', pagerAnchorBuilder: function(idx, slide) { // return sel string for existing anchor return '#slider_nav li:eq(' + (idx) + ') a'; } }); }); </script> Code (markup): with <script type="text/javascript" src="js/jquery.cycle.all.min.js"></script> <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script> <script type="text/javascript"> // <![CDATA[ jQuery(document).ready(function(){ $('#contactform').submit(function(){ var action = $(this).attr('action'); $.post(action, { name: $('#name').val(), email: $('#email').val(), subject: $('#subject').val(), message: $('#message').val() }, function(data){ $('#contactform #submit').attr('disabled',''); $('.response').remove(); $('#contactform').before('<p class="response">'+data+'</p>'); $('.response').slideDown(); if(data=='Message sent!') $('#contactform').slideUp(); } ); return false; }); }); // ]]> </script> Code (markup): Appreciated if someone could help me out or point me in the right direction thanks in advance.
How do you mean combine them? You mean like placing the in the same script tags, one function after the other?
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="js/jquery.cycle.all.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#slideshow').cycle({ fx: 'fade', speed: 'slow', timeout: 2600, pager: '#slider_nav', pagerAnchorBuilder: function(idx, slide) { // return sel string for existing anchor return '#slider_nav li:eq(' + (idx) + ') a'; } }); $('#contactform').submit(function(){ var action = $(this).attr('action'); $.post(action, { name: $('#name').val(), email: $('#email').val(), subject: $('#subject').val(), message: $('#message').val() }, function(data){ $('#contactform #submit').attr('disabled',''); $('.response').remove(); $('#contactform').before('<p class="response">'+data+'</p>'); $('.response').slideDown(); if(data=='Message sent!') $('#contactform').slideUp(); } ); return false; }); }); </script> Code (markup):