4 Replies Latest reply: Jun 24, 2012 4:15 PM by chartoonz RSS

    Javascript with CSS.  I know it can be done

    chartoonz

      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