0

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.

2
Contributors
14
Replies
16
Views
5 Years
Discussion Span
Last Post by ayub05
0

This is the home page code. There may be 11 js scripts. How can i combine these scripts to one? If you can please make this script to a combined script. Please tell me as soon as possible.

<?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>
<body>
  <header>
    <div class="splash">
      <div class="container_24">
      	<div class="logo">
          <h3><a href="index.php">Welcome to Doctorscare24's 24/7 health care</a></h3>
        </div>
        <nav>
        	<ul>
          	<li><a href="index.php" class="current">Home</a></li>
            <li><a href="pedi.php">Pediatrics</a></li>
			<li><a href="fit.php">Fitness</a></li>
           <li><a href="mensh.php"> Mens Health</a> </li>	   
			<li><a href="mental.php">Mental Health</a></li>
			
			
          </ul>
        </nav>
        <div class="slider-wrapper">
        	<div class="indent">
          	<div id="loopedSlider">	
              <div class="container">
                <div class="slides">
                	<!-- slide-1 -->
                  <div>
                  	<div class="inner">
                    	<div class="wrapper">
                      	<div class="mainText">
                        	
                         How to make your child  taller
                          <span>no more feeling  underestimate  </span>
                        </div>
                        <div class="text">
                        	<p> <img src="images/feeling2ooshort copy.jpg" alt="" class="img-indent"> </p>
                          <div class="alignright">
                            <a href="#" class="button">Next</a>
                          
                          </div> 
                        </div>
                      </div>
                    </div>
                  </div>
                  <!-- slide-2 -->
                  <div>
                  	<div class="inner">
                    	<div class="wrapper">
                      	<div class="mainText">
                        	Pediatrics neurology
                          Research
                          <span>For Your Purpose</span>
                        </div>
                        <div class="text">
                        	<p><img src="images/cbrain.jpg" alt="" class="img-indent">   Children health is a one of the important issues in world now.<a href="www.neurology.org"> Neurolgy </a>is also an important part of it. Besiedes this you can get all kinds of health tips.</p>
                          <div class="alignright">
                            <a href="#" class="button">Next</a>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                  <!-- slide-3 -->
                  <div>
                  	<div class="inner">
                    	<div class="wrapper">
                      	<div class="mainText">
                        	
                          How to save yourself 
                          <span>From seasonal flu,bird flu and other flus  </span>
                        </div>
                        <div class="text">
                        	<p><h2> <img src="images/K_featured.jpg" alt="" class="img-indent"></h2> </p>
                          <div class="alignright">
                            <a href="#" class="button">Next</a>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                  <!-- slide-4 -->
                  <div> 
                  	<div class="inner">
                    	<div class="wrapper">
                      	<div class="mainText">
                        	
                         Participate at Brain quiz 
                          <span>and shake your neuron.</span>
                        </div>
                        <div class="text">
                        	<p><h2><img src="images/header_brainbuzz.jpg" alt="" class="img-indent"></p>
                          <div class="alignright">
                            <a href="#" class="button">Next</a>
                           
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <a href="#" class="previous"></a>
              <a href="#" class="next"></a>
            </div>
          </div>
        </div>
      </div>
    </div>
  </header>
  <!-- content -->
  <section id="content">
  	<div class="container_24">  
    	<div class="wrapper">
      	<div class="grid_14">
          <div class="suffix_1">
            <h2>  Fitness, Pediatrics, Weight loss, beauty, mens health, mental health</h2>
			 <h3><center>Contents</center></h3>
			 <br/><br/>
			  <img src="images/vaccine.jpg" alt="" class="img-indent"></p><br/><br/><br/><br/><br/><br/><br/><br/>
			 <p><a href="ph.php"> 
Vaccinations</a>
</p>
			 <img src="images/fett.jpg" alt="" class="img-indent"></p><br/><br/>
			<li><p><a href="fit.php">Why 95% of all conventional diets fail- And the 8 most powerful strategies to Permanently Lose Fat Without Diets or Deprivation</a></p></li><br/><br/>
		<img src="images/bc.jpg" alt="" class="img-indent"></p>	<br/><br/>
			<li><p><a href="fat2rmuscle.php">Body Composition: How to determine your fat to muscle ratio 
</a>
</p></li><br/><br/>
<img src="images/fett.jpg" alt="" class="img-indent"></p><br/><br/>
<li><p><a href="fat2rmuscle.php"> Charting your process:How to use performance feedback to get from where you are to
</a>
</p></li>
<br/><br/>
<img src="images/meal.jpg" alt="" class="img-indent"></p><br/><br/>
<li><p><a href="sec.php"> Secrets of Meal Frequency & Timing: How to Turbo-Charge
Your Metabolism and Turn Your Body Into a Fat Burning Machine!
</a>
</p></li>
<br/><br/><br/><br/>
<img src="images/protein.jpg" alt="" class="img-indent"></p><br/><br/>
			<li><p><a href=
"mensh.php">Protein-The muscle builder and metabolic stimulator
</a></p></li><br/><br/><br/><br/><br/><br/>
<img src="images/bffm.jpg" alt="" class="img-indent"></p><br/><br/>
<li><p><a href="sec.php">  The BFFM Eating Plan: How to Choose Fat-Burning Foods,
Avoid Fat Storing Foods and Easily Design Your Own Effective and
Result-Producing Meals and Menu Plans 
</a>
</p></li>
<br/><br/>
<img src="images/cardio.jpg" alt="" class="img-indent"></p><br/><br/>
<li><p><a href="fit.php">  Cardio Training Secrets For Maximum Fat Loss:
Why it’s Better to Burn the Fat Than to Starve the Fat
</a>
</p></li>

<br/>
          
            
          </div> 
        </div>
        <div class="grid_10">
          <hgroup>
             <h2><a href="au.php">About Us</a></h2>  <br/>
			 <a href="fitnesstip.php" >7 top selling books to get your perfect fitness. Get it free</a>
			 <li><p><img src="images/weightlossnatural.png" alt="" class="img-indent"></p></li> <br/><br/><br/><br/><br/><br/>
			 <li><p><img src="images/secretswig.png" alt="" class="img-indent"></p></li> <br/><br/><br/><br/><br/><br/>
			
			<li><p> <img src="images/musclegrowth.png" alt="" class="img-indent"></p></li> <br/><br/><br/><br/><br/><br/>
			 
			<li><p> <img src="images/guide2weightloss.png" alt="" class="img-indent"></p></li> <br/><br/><br/><br/><br/><br/>
			
			 <li><p> <img src="images/flab2flab.png" alt="" class="img-indent"></p></li> <br/><br/><br/><br/><br/><br/>
			
			 <li><p><img src="images/diettwik.png" alt="" class="img-indent"></p></li> <br/><br/><br/><br/><br/><br/>
			
			<li><p> <img src="images/7secretsoffitness.png" alt="" class="img-indent"></p></li> <br/><br/><br/><br/><br/><br/>
			
			
			 <br/><br/><br/>	 <br/><br/><br/>
			 
			 <h5><a href="resources.php">How to make your child taller</a></h5> <br/><br/>
			<p><h3><img src="https://lh5.googleusercontent.com/-owNYYnC77-0/TuYtNcJRfqI/AAAAAAAAAKQ/vLy0GMtutaY/h120/fi.jpg" alt="" class="img-indent"> <br/><br/><br/>
 <a href="fitnesstip.php" >Get free fitness secrets</a><br/><br/></h3></p>
 		<br/><br/><br/>
			 <a href="http://www.abigdir.com" id="R8BF682">A Big Dir</a><br/>
			 <h5><a href="quiz.php">Participate at quizes related to Body</a>
            <h6>Latest Health News</h6> 
          </hgroup>
         <script type="text/javascript" src="http://www.medicalnewstoday.com/extnews.php?custom=y&id=100800&h=10&b=ddddff&fc=000000&fs=2&sb=y&c=0"></script>
<div align="center" style="font-size:11px;"><a href="http://www.medicalnewstoday.com" target="_blank">health news</a> headlines provided courtesy of Medical News Today.</div>
              <div class="alignright"><a href="gadget.php" class="button">Read More</a></div>
		
		<p>Tags:
		<p><a href="index.php">Pediatric Associate</a>  &nbsp;<a href="index.php">Pediatric</a> &nbsp;<a href="index.php">Pediatricians</a>  &nbsp;<a href="index.php">directory</a>  &nbsp;<a href="index.php">Children Hospital</a> &nbsp;<a href="index.php">Journal</a>  &nbsp;<a href="index.php"> diseases</a> &nbsp;<a href="index.php">Search engine</a>  	   	  
            </li> 
          </ul>
        </div>
      </div>
	  
	  
	<br/><br/>
<li><p><img src="images/epi.jpg" alt="" class="img-indent"></p></li><br/><br/>  
	   <p><a href="epilepsy.php">Epilepsy 
</a></p>
	<br/><br/><br/><br/><br/><br/>
<li><p><img src="images/epdrugs.jpg" alt="" class="img-indent"></p></li><br/><br/>  		
 <p><a href=
"drug.php"> Drugs for epilepsy
</a></p>
<br/><br/><br/><br/><br/><br/>
<li><p><img src="images/seize.jpg" alt="" class="img-indent"></p></li><br/><br/>  
<p><a href=
"seizure.php">  epilepsy seizures
</a></p>
<br/><br/><br/><br/><br/><br/>
<li><p><img src="images/removingpois.jpg" alt="" class="img-indent"></p></li><br/><br/>  
<p><a href=
"moap.php">Technique of Colon Cleansing
</a></p>
<br/><br/><br/><br/><br/><br/>
<li><p><img src="images/treat2aids.jpg" alt="" class="img-indent"></p></li><br/><br/>  

<p><a href=
"treat2aids.php">Treatment For AIDS
</a>
</a></p>

 

<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<li><p><img src="images/aids.jpg" alt="" class="img-indent"></p></li><br/><br/>  
<p><a href="aids.php"> 
AIDS/HIV</a>
</p>


      <iframe id="gadget" scrolling="no" frameborder="no" width="300" height="250" src="http://www.gmodules.com/ig/ifr?up_ad=0&url=http://gadgets.justanswer.com/ja/gahealth/live/300x250-ad.xml?nocache=0&&r=ayub05"></iframe>
	  <br/><br/>
	<img style="visibility:hidden;width:0px;height:0px;" border=0 width=0 height=0 src="http://c.gigcount.com/wildfire/IMP/CXNID=2000002.0NXC/bT*xJmx*PTEzMjIyMTM1OTc3MjgmcHQ9MTMyMjIxMzYwMjI1OCZwPTIwNDMyMSZkPSZnPTEmbz1hODQyZGQwYjY1ZDI*OWRhOTRj/NDQyZGQ5YzNmYjg5MiZvZj*w.gif" />                                                                            <iframe src="http://www.quizrevolution.com/act153566/mini/go/the_dreaming_brain_quiz" width="380" height="400" frameborder="0" scrolling="no" name="mystudiyoIframe" title="QuizRevolution.com"><a href="http://www.quizrevolution.com/act153566/mini/go/the_dreaming_brain_quiz">the_dreaming_brain_quiz</a></iframe>
                                            
                                  <br/>       <br/> <br/>      


  <script language="JavaScript">
<!--
// JavaScript for MediLexicon Search Engine. Do not alter.


function openPharmaWin(formname)
{

if (formname=="acronym") {

  var String = document.acronymForm.keywords.value;
  var User = document.acronymForm.username.value;
  var Searchtype = "acronym";
		
} else {
		
  var String = document.definitionForm.keywords.value;
  var User = document.definitionForm.username.value;
  var Searchtype = "keyword";
		
}

String = escape(String);

pharmaWin=window.open("http://www.medilexicon.com/extsearch.php?keywords=" + String + "&searchtype=" + Searchtype + "&username=" + User, "Pharma_Search", "toolbar=0,status=no,menubar=no,scrollbars=yes,resizable=yes,width=730,height=660,left=10,top=10");

}


// -->
</script>

<!-- Code for MediLexicon Search Box -->

<table border=0 width=160 cellspacing=0 cellpadding=3>
<tr>
  <td bgcolor=#ddddff align=center><font face='arial,helvetica' size=2>Medical Abbreviations</td>
</tr>
 <tr>
  <td bgcolor=#ffffff align=center>

<form name="acronymForm" onSubmit="openPharmaWin('acronym');return false">
<table border=0 width=100% cellspacing=0 cellpadding=3>
<tr>
<td colspan=2 bgcolor=#ffffff><font face='arial,helvetica' size=2>Search By Abbreviation</td>
</tr>
<tr>
<td width=80% bgcolor=#ffffff><input type=text name=keywords style="width:110px;" size="10"></td>
<td width=20% bgcolor=#ffffff><input type=submit value="Go!" style="font-family:arial,helvetica; font-size: 8pt; color: #000000">
</td>
</tr>
</table>
<input type=hidden name=username value=z56756>
</form> 

  </td>
 </tr>
 <tr>
  <td bgcolor="#ffffff" align="center">

<form name="definitionForm" onSubmit="openPharmaWin('definition');return false">
<table border=0 width=100% cellspacing=0 cellpadding=3>
<tr>
<td colspan=2 bgcolor=#ffffff><font face='arial,helvetica' size=2>Search By Definition</td>
</tr>
<tr>
<td width=80% bgcolor=#ffffff><input type=text name=keywords style="width:110px;" size="10"></td>
<td width=20% bgcolor=#ffffff><input type=submit value="Go!" style="font-family:arial,helvetica; font-size: 8pt; color: #000000">
</td>
</tr>
</table>
<input type=hidden name=username value=z56756>
</form> 

  </td>
 </tr>
 <tr>
  <td bgcolor="#ddddff" align="center">

<form name="dictionaryForm" action="http://www.medilexicon.com/medicaldictionary.php" target="_blank">
<table border=0 width=100% cellspacing=0 cellpadding=3>
<tr>
<td colspan=2 bgcolor=#ddddff><font face='arial,helvetica' size=2 color=#000000>Medical Dictionary</td>
</tr>
<tr>
<td width=80% bgcolor=#ddddff><input type=text name="s" style="width:110px;" size="10"></td>
<td width=20% bgcolor=#ddddff><input type=submit value="Go!" style="font-family:arial,helvetica; font-size: 8pt; color: #000000"></td>
</tr>
</table>
<input type=hidden name=username value=z56756>
</form>

  </td>
 </tr>
 <tr>
  <td align="center">

 <table border=0 width=100% cellspacing=0 cellpadding=3>
  <tr>
   <td align=center><a href='http://www.medilexicon.com/medicaldictionary.php' target=_blank><font face='arial,helvetica' size=1>medical dictionary</a> search provided by MediLexicon.com</td>
  </tr>
 </table>

  </td>
 </tr>
</table>

<!-- End of code for MediLexicon Search Box -->


		<h1 class="isearch">Search This Site</h1>
<br />

<form method="post" action="/isearch2/index.php" target="_self" name="isearch_form" style="text-align: center">

<script type="text/javascript">
<!--
function searchClickedSimple(form)
{
    if (form.s.value=='')
    {
        alert("Please enter a term to search for.");
        return false;
    }
    return true;
}
// -->
</script>

<div style="text-align: center; margin: 0 auto" >
    <label for="s">Simple&nbsp;Search</label>:
    <input type="text" maxlength="255" name="s" size="40" value="" />

    <label for="partial">Partial</label>:
    <input type="checkbox" name="partial" />

    <input type="submit" value="Search Site" onClick="return searchClickedSimple(this.form);" />

    <input type="submit" name="internet" value="Search Internet" onClick="return searchClickedSimple(this.form);" />

    <a target="_blank" href="/isearch2//help/help.php">Help</a>

    <a href="/isearch2/index.php?advanced=1">Advanced&nbsp;Search</a>

</div>

<input type="hidden" name="action" value="search" />
</form>

</html>

<!-- [url]www.000webhost.com[/url] Analytics Code -->
<script type="text/javascript" src="http://analytics.hosting24.com/count.php"></script>
<noscript><a href="http://www.hosting24.com/"><img src="http://analytics.hosting24.com/count.php" alt="web hosting" /></a></noscript>
<!-- End Of Analytics Code -->

 </div>
        </div>
      </div>
    </div>
  </section>
  <!-- footer -->
  <footer>
    <div class="container_24">
    	<div class="clearfix">
      	<a href="http://doctorscare24.info">This website</a> copyrighted by <a  href="http://doctorscare24.info">DoctorsCare24's Pediatric Assoc</a>
        <nav>
          <ul>
          	<li><a href="sitemap.php">Site map</a></li>
            <li><a href="#">Help</a></li>
            <li><a href="#">Terms of Use</a></li>
          </ul>
        </nav>
      </div>
    </div>
  </footer>
  </body>
  </html>

Edited by __avd: Added [code] tags.

0

The first thing I would do is move all your scripts out into external js files and load them into your page rather than having them inline. Then the second thing would be to place them just before the closing body tag so that your page loads before you try and load/call the js files.

0

I understand the first thing. But i did not understand second thing " would be to place them just before the closing body tag so that your page loads before you try and load/call the js files". can u show some example so that i can understand.

0

OK, put all of your links to your external js files (including the ones you will be creating) at the bottom of your page before the body closing tag

<body>
// all your HTML here
<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>
</body>

Edited by simplypixie: n/a

0

I don't know how to write external script. Would you make it for me please?

0

i mean How to create link in external js script files?

0

Just copy your inline scripts to a new file, save it as as .js file and link to it the same way your other javascript files are linked.

So, for example, take your first bit of inline code

$(function(){
$('#loopedSlider').loopedSlider({
autoStart: 6000
});
});

Paste it into a file and save that file in your js folder as autoload.js (or whatever you want to call it).

Then link to it as such

<script type="text/javascript" src="js/autoload.js"></script>

Remember to remove the code that you have saved into a new js file from your page

0

Sorry i understand now. let me make a try.

Edited by ayub05: n/a

0

No, that is already a link to an external script so leave it as it is and move it to the bottom of your page with all the other script links.

0

OK, put all of your links to your external js files (including the ones you will be creating) at the bottom of your page before the body closing tag

<body>
// all your HTML here
<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>
</body>

Why not i will give this code before head closing tags? Is it not good more?

0

It means that the page will load before your javascript tries to run - better for page load time and the same as you should use document.ready() function in javascript coding so that the server doesn't try to run javascript that is related to content in the page before the page has loaded.

I really suggest you Google for some basic Javascript tutorials to learn about the basics of how it works and how to use it before trying to implement it in your own web pages.

0

Firefox doesn't support the DEFER attribute. In Internet Explorer, the script may be deferred, but not as much as desired. If a script can be deferred, it can also be moved to the bottom of the page. That will make your web pages load faster.

Then after doing this if firefox does not support what can i do?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.