Skip navigation
Currently Being Moderated

Javascript with CSS.  I know it can be done

Jun 24, 2012 2:33 PM

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 exteranl 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 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.


As always thanks,

 

 

Aharon

 
Replies
  • Currently Being Moderated
    Jun 24, 2012 2:42 PM   in reply to chartoonz

    Hi

     

    Is there any reason you you can't use a simple SSI (Server Side Include) file?

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 24, 2012 3:17 PM   in reply to chartoonz

    Sorry, no JS knowledge here, but I would think you need a trigger of some sort like body onload

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points