Fedora Linux Support Community & Resources Center
  #1  
Old 9th April 2009, 11:19 AM
meowdin Offline
Registered User
 
Join Date: Feb 2008
Location: HK
Age: 31
Posts: 196
javascript roll over funny phenomenon

Hi,

I have a piece of html like below, and it's working. But the problem is the part that I pass the variable of file path on
Quote:
<input id="but" type="button" value="<" onclick="mainwin('main_img', 'ima/2.jpg');" />
It seems only the file path start with "img" will work, I tried image/1.jpg, 1/1.jpg .... or even img/1/1.jpg, none of them will load the image. Javascript seems to treat it like a broken path, or broken script.

Has anyone any idea what's goning on here? My initial intention was to store 3 side of picture under the directory of one entity, according to the entity's id.

Like
/1/1.jpg
/1/2.jpg
/1/3.jpg
/2/1.jpg
...etc

Now i feeling like having a problem to tell my team mate about my "idea"....

Please help, the most importantly, what's going on, any information is appreciated

Quote:
<html>
<head>

<script language="javascript" type="text/javascript">
function mainwin(imgname, imgsrc)
{
document[imgname].src = imgsrc;
}
</script>
</head>
<body>
<img src="1/1.jpg" name="main_img" width="200px" height="150px" />

<br/>
<input id="but" type="button" value="<" onclick="mainwin('main_img', 'ima/2.jpg');" />
</body>
</html>
Reply With Quote
  #2  
Old 10th April 2009, 06:57 PM
BandC's Avatar
BandC Offline
Registered User
 
Join Date: Nov 2004
Posts: 1,105
Hard to say without seeing your directory structure. My suggestion is use Firebug to troubleshoot the problem. You should be able to find what's going on quickly.
Reply With Quote
  #3  
Old 11th April 2009, 09:16 AM
meowdin Offline
Registered User
 
Join Date: Feb 2008
Location: HK
Age: 31
Posts: 196
Hi,

My directory is simple

/test.htm (with the script)

These are working:
/img/1.jpg
/img/2.jpg

These are not working:
/1/1.jpg
/2/2.jpg

These are also not working, and I would like to know why
/img/1/1.jpg
/img/1/2.jpg
/img/2/1.jpg

All of the above file stay in same directory, like /home/me/Desktop/test

I will check up with the Firebug and thx for the suggestion
Reply With Quote
  #4  
Old 12th April 2009, 06:04 PM
meowdin Offline
Registered User
 
Join Date: Feb 2008
Location: HK
Age: 31
Posts: 196
I am so sorry, I am dumb ***, the files in my other directories are having *.Jpg extension instead of *.jpg, but I only figure this out after putting them into my apache , as it remove previous picture and replace with an empty picture, unlike when I just open the htm file with firefox where the original picture was not affected at all. Makes me suspect Javascript will only work with certain file path ...
Reply With Quote
Reply

Tags
funny, javascript, phenomenon, roll

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Looking for AdobeReader_enu-8* to roll back wneumann Using Fedora 2 21st April 2009 05:03 PM
A confused starting start phenomenon for Fedora sheepyang Hardware & Laptops 4 9th March 2007 11:27 AM
Weird ReiserFS and wireless phenomenon on clean install of FC5 infraray EOL (End Of Life) Versions 0 23rd April 2006 02:29 AM
Installing a roll of RPMS at once KalasMannen Using Fedora 4 3rd December 2005 07:39 PM


Current GMT-time: 18:20 (Saturday, 25-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat