View Full Version : Image path trouble.
Mankato
11-15-2002, 11:00 PM
I'm doing a double image swap but when ever I put the path of the image in the code it won't work. It will only work of the image is in the same directory as the source.
Here's what I got...
function mv(){
if (flgg) {
if (flg==0){
document.a.src="oneon.gif";
document.t.src="1on.gif";
}
It won't work like this and I can't figure out why...
function mv(){
if (flgg) {
if (flg==0){
document.a.src="images\oneon.gif";
document.t.src="images\1on.gif";
}
Can anyone help me out?
Thanks!
boggly
11-15-2002, 11:42 PM
I don't mean to oversimplify, but I think you should have a forward slash instead of a backslash in your image paths. Also, depending on whether there's more code, the snippet you posted is missing braces. I'd also recommend combining your two if condionals into one like this:
if (flgg && flg==0)
{
// your statments
}
Regards,
boggly
Mankato
11-16-2002, 01:08 AM
*kicks self in head*
Ah man I'm an idiot... must of had a brain fart or something.
Thanks man!
boggly
11-16-2002, 01:22 AM
No problem, simple mistake.
-boggly
whammy
11-16-2002, 01:30 AM
:)
backwards slashes only work if you're referring to a LOCAL file, i.e. one on your hard drive (or in the case of server-side languages, a local path on the server).
Mankato
11-16-2002, 08:41 AM
Yeah thats where I went wrong. I code off my hard drive and then upload the files when I'm done. I guess I forgot to change the paths.
BTW - Thanks for your tip on post #2 boggly. I didn't think of that. I'm kinda new to JS and I'm thinking in 2 demensions. And yeah... there was more to my code then just that.
Thanks
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.