JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old July 11th, 2005, 11:47 AM
jessabean jessabean is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 2 jessabean User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 27 m 50 sec
Reputation Power: 0
Problem with images in .js file

I am trying to create a template in Dreamweaver. Because the left navigation bar (which is an uneditable region in the template) contains quite a few links, I've consolidated related links and am using a javascript collapsible menu. My problem is that the images defined in my .js file don't seem to work when I go beyond a certain subfolder in my directory. I am not sure if it is because of the relationship with the template, or what.

My directory structure:

Template located in: TDLWeb/templates/TDLTemp.dwt
JS file located in: TDLWeb/tdl.js
Images located in: TDLWeb/graphics
HTM page #1 located in: TDLWeb/home.tdl/tadil1.htm
HTM page #2 located in: TDLWeb/home.tdl/home.ccb/ccb1.htm

The images all work fine in tadil1.htm (HTM page #1), but when I apply the template to ccb1.htm (HTM page #2), the images are broken. When I click on the image, it should expand the hidden div menu as well as toggle the images. Both pages expand/collapse the menu just fine, but the image problem is driving me crazy.

I hope I explained this well enough. Can elaborate further if this is confusing.

Here is the javascript code I'm working with in my .js file:

function Toggle(item) {
obj=document.getElementById(item);
visible=(obj.style.display!="none")
key=document.getElementById("x" + item);
if (visible) {
obj.style.display="none";
key.innerHTML="<img src='../graphics/arrowopen.gif' border='0'>";
} else {
obj.style.display="block";
key.innerHTML="<img src='../graphics/arrowclose.gif' border='0'>";
}
}

function Expand() {
divs=document.getElementsByTagName("SPAN");
for (i=0;i<divs.length;i++) {
divs[i].style.display="block";
key=document.getElementById("x" + divs[i].id);
key.innerHTML="<img src='../graphics/arrowclose.gif' border='0'>";
}
}

function Collapse() {
divs=document.getElementsByTagName("SPAN");
for (i=0;i<divs.length;i++) {
divs[i].style.display="none";
key=document.getElementById("x" + divs[i].id);
key.innerHTML="<img src='../graphics/arrowopen.gif' border='0'>";
}
}

Reply With Quote
  #2  
Old July 11th, 2005, 12:34 PM
ezenaide's Avatar
ezenaide ezenaide is offline
custom user
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: olinda - br
Posts: 77 ezenaide User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 12 h 44 m 50 sec
Reputation Power: 4
Send a message via MSN to ezenaide
maybe if you use complete urls...

try use "file:///c:/anyway/graphics/" instead of "../graphics/"

Reply With Quote
  #3  
Old July 11th, 2005, 01:33 PM
jessabean jessabean is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 2 jessabean User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 27 m 50 sec
Reputation Power: 0
Quote:
Originally Posted by ezenaide
maybe if you use complete urls...

try use "file:///c:/anyway/graphics/" instead of "../graphics/"


If I tie all of my images to a "local" URL, won't I encounter the same broken image problem if I try and upload all of the files to a different server?

Reply With Quote
  #4  
Old July 11th, 2005, 02:13 PM
ezenaide's Avatar
ezenaide ezenaide is offline
custom user
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: olinda - br
Posts: 77 ezenaide User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 12 h 44 m 50 sec
Reputation Power: 4
Send a message via MSN to ezenaide
sure. but the idea is to test and, if working well, change the urls before upload.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Problem with images in .js file


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway