Javascript Parent Directory -
ok, let me explain this. site layout (for example)
localhost/mydomain/ -localhost/mydomain/pics -localhost/mydomain/somepages/arandompage.php
so on page localhost/mydomain/index.php
//(thumbnail rotator)//
<img id='4' src='pics/somepic.1.jpg'>
the mouseover snippet
{ $('#'+someid).attr('src', 'pics/somepic.'+num+'.jpg');
//no need me include rest since works. works on localhost/mydomain/index.php when go localhost/mydomain/somepages/arandompage.php doesn't work, no longer relative.
<img id='4' src='../pics/somepic.1.jpg'>
ok here that'll fix display image...but have tried searched everywhere javascript go 1 directory..
{ $('#'+videoid).attr('src', '../pics/somepic.'+num+'.jpg'); //doesn't work
i don't know here, yes need javascript 1 folder img src. thats all... after 8+ hours damn near given because seems simple not find answer, please if know please respond. , if answer please insert should here in
`{ $('#'+videoid).attr('src', ====> 'pics/somepic.'+num+'.jpg');`
so goes parent directory.
p.s. tried absolute paths no avail either.
the key thing remember browser's view of hierarchy is:
assuming
localhost/mydomain
root of site, then:...a page
localhost/mydomain/somepage.php
:will appear @ e.g.
http://example.com/somepage.php
browser's povand can use
pics/somepic.jpg
or/pics/somepic.jpg
pic.
...a page
localhost/mydomain/somepages/somepage.php
:will appear @ e.g.
http://example.com/somepages/somepage.php
browser's povand can use
../pics/somepic.jpg
or/pics/somepic.jpg
pic.
assuming
localhost
root of site instead, then:...a page
localhost/mydomain/somepage.php
will appear @ e.g.,
http://example.com/mydomain/somepage.php
browser's povand can use
pics/somepic.jpg
or/mydomain/pics/somepic.jpg
pic.
...a page
localhost/mydomain/somepages/somepage.php
will appear @ e.g.,
http://example.com/mydomain/somepages/somepage.php
browser's povand can use
../../pics/somepic.jpg
or/mydomain/pics/somepic.jpg
pic.
Comments
Post a Comment