I'm still a total noob. But I am trying something and I was hoping someone could help me. I have a very simple idea. I've been researching it but I am so green that I don't seem to be asking the right questions so I thought I'd come to the experts.
I want to generate a footer div in my current web project. I want that div to have text in it generated by and external javascript page. I know it can be done but the syntax is off somehow... Here's what I've got so far
HTML PAGE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="javaWritingTest01.js"></script>
</head>
<body>
<div class="footer"> </div>
</body>
</html>
JAVAWRITINGTEST02.JS:
// JavaScript Document
function footerText()
{
$('.footer').html('<p>This is the Footer</p>');
}
I thought that the because the html doc (seen above) calls the .js it would automatically (magically) find the footer class and insert the html. Clearly I am wrong. I am looking it up over at w3schools but I would appreciate any enlightenment anyone could offer. Please be kind, I really am new at this...
sorry before I should have said external javascript.
As to your reply (and thanks by the way) I am not sure I follow are you saying I should source the script down in the div and not up in the head? What if I want to eventually grow the script and do other things with it..?
Bookmarks