Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Using DHTML Javascript 'Globally'


  • Please log in to reply

#1
Spider-Man

Spider-Man

    Member

  • Member
  • PipPipPip
  • 167 posts
Hello there.

I have looked around for a vertical image slideshow and have found Dynamic Drive's 'Up-Down Image Slideshow Script' is ideal for our needs.

Unfortunately as we add new products regularly, we would have to edit every single page on our site for it to update with the image/link.

What we would like to do, on our new site http://www.gardeningontheweb.co.uk, is to show images of our product categories(eg. a n aquarium - which is linked to our aquatic shop department. The scrolling images will appear in the area marked "Text/images/promotion for CGC Actinic pages", along with small marketing introductions.

So the idea is to put the javascript code in a file, say slide.js

Inside each html document, put the code as <script src="slide.js"></script>

This will then 'call' the slide.js file when you go to another page, thus meaning to add new images/image links all we need to do is add 1 line of code to the slide.js file.

Unfortunately when I have tried this, nothing appears. I have copied the code directly, yet it doesn't work - the area where the scrolling images should be disappears. Yet when I copy and paste the code as Dynamic Drive instruct you to do so, into the html document, it works perfectly.

So, my question is: is is possible to put the javascript in a file, call that file, so that only the javascript file ever needs edited?

As the code is quite long, I have only posted the link to the page where you can view the code as well as see what it looks like.


Thank you:D
  • 0

Advertisements


#2
Major Payne

Major Payne

    Retired Staff

  • Retired Staff
  • 5,307 posts
I use an horizontal slide show where image links are added to the js file only. To just update the slide for every page only the js has to be changed and uploaded. Your vertical menu should work the same. I basically use this for the horizontal slideshow:

<script type="text/javascript" src="dsns_js/js_banner_scroller.js"></script><div class="ctr"><p>On mouseover, images will pause. Click image selected to see in new window.</p>

Can you post the link to Dynamic Drive's 'Up-Down Image Slideshow Script? Will then look at your script and see what happened.

Ron

Edited by Major Payne, 01 September 2007 - 07:15 AM.

  • 0

#3
Spider-Man

Spider-Man

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 167 posts
Hi Ron. Thanks for your reply.

Sorry that I missed out the link in my initial post, this is the link:

http://dynamicdrive....updownslide.htm


Thank you
  • 0

#4
Major Payne

Major Payne

    Retired Staff

  • Retired Staff
  • 5,307 posts
OK. Thanks. I took a look at your new page. No where could I find products.js. Are you sure you are calling out the correct path or even uploaded the js file?

Ron
  • 0

#5
Spider-Man

Spider-Man

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 167 posts
Hello again Ron.

Sorry, If you hadn't noticed with the slowness of the site, I am using Freehostia at the moment for hosting while testing the site. I have now added all files, html and javascript, so you should now be able to experience the same problems as myself.


Thank you
  • 0

#6
Major Payne

Major Payne

    Retired Staff

  • Retired Staff
  • 5,307 posts

I have now added all files, html and javascript,...


I must be blind or have gone totally senile, but I find no javascript of any kind on either your page or in an external file being called from the page you mentioned. Using all the web tools at ny disposal, nothing shows up.

Ron
  • 0

#7
Spider-Man

Spider-Man

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 167 posts
Site is now up and running Ron. No big deal, we just got rid of the javascript links to our main site, replaced them with Google Adsense. And hope everything builds up now:)

Thank you
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP