Adding the scripts to the page!!

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Adding the scripts to the page!!
Neoszion
CZ Super Newbie
 Codezwiz Site Donator
Neoszion has been a member for over 20 year's 20 Year Member
uk.gif
Occupation: Web Designer
Age: 45
Gender: Male
Fav. Sports Team: Liverpool
Website:
Status: Offline
Joined: Sep 02, 2004
0.01 posts per day
Posts: 92
Points: 10,111
   
Hi I have found a couple of js files that i wanna add to me site but i cannnot figure out where to put the code in the page for eg. System clock = Do i put the js file in the scripts folder and then the code in the header.php file or index.php and where on those pages do i put them..



Back to top Reply with quote
#2   re: Adding the scripts to the page!!
nomadesign
CZ Super Newbie
nomadesign has been a member for over 20 year's 20 Year Member
usa.gif
Status: Offline
Joined: Jun 24, 2004
0.01 posts per day
Posts: 71
Points: 2,907
   
Hello Neoszion:

Script codes usually go in the header.
Then there would be an onLoad in the body tag.

example for a system clock.
this would be under your head

This would be the script

function runClock() {
   var timeNow = new Date()
   var hours = timeNow.getHours()
   var minutes = timeNow.getMinutes()
   var seconds = timeNow.getSeconds()
   var ampm = ""

      if (seconds<10) {
      seconds = "0" + seconds
   }

      if (minutes<10) {
            minutes = "0" + minutes
      }

   if (hours<12) {
      ampm = "AM"
   } else {
      ampm = "PM"
      
   }
   if (hours>12) {
      hours = hours-12
   }
      if (hours == 0){   
            hours = 12 
      }
   
   var stringTime = " " + hours + ":" + minutes + ":" +seconds + " " + ampm
   document.forms[0].clockBox.value=stringTime
   setTimeout("runClock()",1000)
}
//-->
// end of script


This would be in your body tag
onLoad="runClock()"
This would be under your body tag

<TABLE WIDTH=100%>
<TR VALIGN=BOTTOM>
<TD><H1>Time Watcher</TD>
<TD ALIGN=RIGHT><INPUT TYPE="text" NAME="clockBox" size=15></H1>
</TD></TR></TABLE>
<HR>


hope this helps.
-damon
PS I don't think you would need a folder for javaScript...


Back to top Reply with quote
#3   re: Adding the scripts to the page!!
Neoszion
CZ Super Newbie
 Codezwiz Site Donator
Neoszion has been a member for over 20 year's 20 Year Member
uk.gif
Occupation: Web Designer
Age: 45
Gender: Male
Fav. Sports Team: Liverpool
Website:
Status: Offline
Joined: Sep 02, 2004
0.01 posts per day
Posts: 92
Points: 10,111
   
Sorry dude that sort of does make sense but im a newbie to cvoding and scripts.. Where do I add the code and what file would I have to edit



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum