1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

how to combine js scripts to one script?

Discussion in 'JavaScript' started by wazed05, Dec 16, 2011.

  1. #1
    My website's performance has decreased. My website needs 13 secs to download. So i want to combine js scripts to one script. But i don't know how to do it. Please tell me very easy ways to combine js scripts to one.

    If you can please combine all js scripts to one. I am totally novice programmer.


    Here is the home page code:

    <?php include './include.php';?>
    <!DOCTYPE html>
    <html lang="en">
    <head>
      <title>Doctorscare24's 24/7 health care</title>
         <script type="text/javascript" src="js/html5.js"></script>
        
      
      <script type="text/javascript">
    
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-26211200-1']);
      _gaq.push(['_trackPageview']);
    
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    
    </script>
    <meta name="alexaVerifyID" content="GlO_yDjmSUpXLZQ19nRYpqxnGDI"/>
    <meta name="description" content="Pediatric Association's children hospital is very helpful to people. You can find journal of Pediatrics here. " />
    <meta name="keywords" content="Pediatricians,Pediatric ,Pediatric Association,Pediatric Associates,Pediatrics journal,Pediatric journal,journal of Pediatrics,journal  Pediatrics,children hospital, Pediatric neurology,Pediatric health, Pediatrics in review,GlO_yDjmSUpXLZQ19nRYpqxnGDI" />
    
    
    
       <meta charset="utf-8">
      <link rel="stylesheet" href="css/reset.css" type="text/css" media="all">
      <link rel="stylesheet" href="css/grid.css" type="text/css" media="all">
      <link rel="stylesheet" href="css/style.css" type="text/css" media="all">
      <link rel="stylesheet" href=  "/comments/comment_script/comment_script_1.4.1/template/default/style.css" type="text/css" media="all"/>
      <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> 
      <script type="text/javascript" src="js/loopedslider.js"></script>
      <script type='text/javascript' src='js/menu.js'></script>
      <script type='text/javascript' src='jquery-1.2.3.min.js'></script>
      <script type="text/javascript">
            $(function(){
                $('#loopedSlider').loopedSlider({
                    autoStart: 6000
                });
            });
        </script>
          <!--[if lt IE 7]>
          <script type="text/javascript" src="http://info.template-help.com/files/ie6_warning/ie6_script_other.js"></script>
      <![endif]-->
      <!--[if lt IE 9]>
          <script type="text/javascript" src="js/html5.js"></script>
     <![endif]-->
      </head>
    
    HTML:
     
    Last edited: Dec 16, 2011
    wazed05, Dec 16, 2011 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #2
    The javascript is in linked files and will be cached. It is extremely unlikely that it is causing the speed problems on your site.

    Some javascript libraries supply two copies, one with whitespace (a bigger file) and one without. The one with is much easier to read and debug while the one without will load more quickly.

    I'd look at server issues and image sizes and even your css before you go messing with those particular javascript files.

    You may get some speed advantages by serving javascript and static images from a subdomain which is more about how browsers work than about how your site is constructed.
     
    sarahk, Dec 17, 2011 IP
  3. Rainulf

    Rainulf Active Member

    Messages:
    373
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    85
  4. JohnnySchultz

    JohnnySchultz Peon

    Messages:
    277
    Likes Received:
    4
    Best Answers:
    7
    Trophy Points:
    0
    #4
    JohnnySchultz, Dec 18, 2011 IP
  5. mmerlinn

    mmerlinn Prominent Member

    Messages:
    3,197
    Likes Received:
    818
    Best Answers:
    7
    Trophy Points:
    320
    #5
    Cut and paste all of your javascript files into one text document. Then save as a new javascript file. 30 seconds and you are done.
     
    mmerlinn, Dec 22, 2011 IP