Pregunta

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Practice!</title>
<link href="../_css/site.css" rel="stylesheet">

This is my source for jquery (which I got from my text book)

<script src="../_js/jquery-1.7.2.min.js">
</script>


<script src="javascript/hello.js">
</script>

<script src="javascript/fadeIn1.js">
</script>

<script src="javascript/igotit.js">
</script>


</head>

<body>
<div class="wrapper">
  <div class="header">
    <p class="logo">JavaScript <i>&</i> jQuery <i class="mm">The<br>
      Missing<br>
      Manual</i></p>
  </div>
  <div class="content">
    <div class="main">
      <h1>Fading In</h1>
      <p>Here I come!!!</p>
    </div>
    <div class="aside"> </div>
  </div>
  <div class="footer">
    <p>JavaScript &amp; jQuery: The Missing Manual, by <a href="http://sawmac.com/">David McFarland</a>. Published by <a href="http://oreilly.com/">O'Reilly Media, Inc</a>.</p>
  </div>
</div>
</body>
</html>

This is what my external javascript files look like. For my external files, would they just need to be the "<script>" part of the code or the whole entire "<DOCTYPE>" to "</html>"?

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Fade In</title>
<link href="../_css/site.css" rel="stylesheet">
<script src="../_js/jquery-1.7.2.min.js">
</script>
<script>
$(document).ready(function() {
$('body').hide().fadeIn(3000);
});

</script>
</head>

<body>
<div class="wrapper">
  <div class="header">
    <p class="logo">JavaScript <i>&</i> jQuery <i class="mm">The<br>
      Missing<br>
      Manual</i></p>
  </div>
  <div class="content">
    <div class="main">
      <h1>Fading In</h1>
      <p>Here I come!!!</p>
    </div>
    <div class="aside"> </div>
  </div>
  <div class="footer">
    <p>JavaScript &amp; jQuery: The Missing Manual, by <a href="http://sawmac.com/">David McFarland</a>. Published by <a href="http://oreilly.com/">O'Reilly Media, Inc</a>.</p>
  </div>
</div>
</body>
</html>

Sorry, I am new to this and am having troubles.

¿Fue útil?

Solución

Your external files should only have JavaScript in them, so nothing that looks like

<this/>

should be in them. It looks like you just want:

$(document).ready(function() {
    $('body').hide().fadeIn(3000);
});

...in your fadein1.js. Likewise for the other JS files.

When you have the document open in your browser, press F12 for some useful messages to paste here if it still isn't working.

Otros consejos

Is Jquery file in the right location? If you are not sure just use this link for jquery:

<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top