Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 24th, 2007, 11:00 PM   #1
Wizard1988
Professional Programmer
 
Wizard1988's Avatar
 
Join Date: Oct 2005
Location: Chitown
Posts: 416
Rep Power: 3 Wizard1988 is on a distinguished road
Send a message via AIM to Wizard1988
Adding div elements with JavaScript

I have a page which lists information on courses Link. I am trying to create a back to top link after the information for each course.

Each section describing a course looks like this

<div class="article">
    <div class="courseTitle">SCI202    CHEMISTRY 1.0 Cr.<a name="chemistry" id="chemistry"></a></div>
    <div class="courseCategory">Prereq:</div>
    <div class="content">Having passed Integrated Physics and Algebra 1 or Algebra A-B.</div>
<div class="courseCategory">Description:</div>
    <div class="content">
        <p>This course is designed for sophomores who have successfully completed Integrated Physics and Algebra 1 or Algebra A-B.  The subject matter includes the study of the following topics: scientific methods, matter, energy, atoms (behavior and interactions), periodic table, gases, liquids, solids and stoichiometry.  This course is designed to give the student an overview of the basic concepts of chemistry, including how chemistry relates to biology, physics, and earth science.  Students will use various forms of technology to collect, analyze, and report data.</p><p><strong>This course is required and is a prerequisite for biology.</strong></p>
</div>
</div>
How would I go about adding a .backUp element after the last content section within the article?

Any hints or tips are welcome.
__________________
JG-Webdesign
Wizard1988 is offline   Reply With Quote
Old Feb 25th, 2007, 6:38 AM   #2
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 4 Arevos is on a distinguished road
Place something like:
html Syntax (Toggle Plain Text)
  1. <a name="top"/>
At the top of the page, and:
html Syntax (Toggle Plain Text)
  1. <a href="#top">Back to top</a>
At the bottom.
Arevos is offline   Reply With Quote
Old Feb 25th, 2007, 8:38 AM   #3
Wizard1988
Professional Programmer
 
Wizard1988's Avatar
 
Join Date: Oct 2005
Location: Chitown
Posts: 416
Rep Power: 3 Wizard1988 is on a distinguished road
Send a message via AIM to Wizard1988
I know I can do that. However I am looking for a way to automatically add that link after every section describing a class. I hope this clears things up.
__________________
JG-Webdesign
Wizard1988 is offline   Reply With Quote
Old Feb 25th, 2007, 10:53 AM   #4
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 4 Arevos is on a distinguished road
Oh, I see. I'd recommend first getting Prototype, which is a widely used javascript library that makes tasks like these so much easier. And then maybe something like:
javascript Syntax (Toggle Plain Text)
  1. document.getElementsByClassName("article").each(function(article) {
  2. new Insersion.Bottom(article,
  3. '<div class="content"><a href="#top">Return to top</a></div>')
  4. }
Arevos is offline   Reply With Quote
Old Feb 25th, 2007, 11:05 AM   #5
Wizard1988
Professional Programmer
 
Wizard1988's Avatar
 
Join Date: Oct 2005
Location: Chitown
Posts: 416
Rep Power: 3 Wizard1988 is on a distinguished road
Send a message via AIM to Wizard1988
I actually figured it out, but it was much messier than what you did. I think I will check out Prototype.

Thanks.
__________________
JG-Webdesign
Wizard1988 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
disable 'backspace' key in Javascript. pushkarajthorat JavaScript and Client-Side Browser Scripting 1 Dec 26th, 2006 6:01 AM
Hidden unless Javascript enabled? Writlaus JavaScript and Client-Side Browser Scripting 3 Apr 25th, 2006 10:52 PM
Javascript alternative? Writlaus JavaScript and Client-Side Browser Scripting 32 Apr 21st, 2006 12:44 AM
HTML page not reading external Javascript file aznluvsmc JavaScript and Client-Side Browser Scripting 9 Nov 21st, 2005 9:17 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:00 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC