473,770 Members | 6,713 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Obtain relative path to image

Is there a way to obtain the relative path of an image through
javascript? I'm using document.imageN ame.src right now, and all I get
is the absolute path. Thanks in advance for the help!
Jul 20 '05 #1
2 10285
AV
strip from it the url section manipulationg the string.
sort of:
url=location.hr ef.substring( location.href.i ndexOf("yourweb .com" )+
"yourweb.com".l ength );
ciao
http://www.unitedscripters.com/

"midwesthil ls" <mi**********@h otmail.com> ha scritto nel messaggio
news:1f******** *************** **@posting.goog le.com...
Is there a way to obtain the relative path of an image through
javascript? I'm using document.imageN ame.src right now, and all I get
is the absolute path. Thanks in advance for the help!

Jul 20 '05 #2
AV
sorry, of course I meant
image.src not location.href, but the idea is the same basically. ciao
"AV" <NO****@hotmail .com> ha scritto nel messaggio
news:bq******** **@lacerta.tisc alinet.it...
strip from it the url section manipulationg the string.
sort of:
url=location.hr ef.substring( location.href.i ndexOf("yourweb .com" )+
"yourweb.com".l ength );
ciao
http://www.unitedscripters.com/

"midwesthil ls" <mi**********@h otmail.com> ha scritto nel messaggio
news:1f******** *************** **@posting.goog le.com...
Is there a way to obtain the relative path of an image through
javascript? I'm using document.imageN ame.src right now, and all I get
is the absolute path. Thanks in advance for the help!


Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
78646
by: Rizaan Jappie | last post by:
is it possible to get the relative path based on a absolute path in c#? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
6
3037
by: David W. Simmonds | last post by:
I know that I can create an Image object by using a path like C:\MyPictures\pic.jpg, but how can I create an Image object by using a path like /MyPictures/pic.jpg where the path is relative to the site. For instance, if the site is http://www.foobar.com, then /MyPictures/pic.jpg would be fully qualified by http://www.foobar.com/MyPictures/pic.jpg. Presumably there is a way to get the fully qualified path by giving the relative path.
6
11780
by: openleren | last post by:
Hi all, how can I use a relative path in my web.config file for an Access db?: Instead of using <configuration> <appSettings> <add key="conAccess" value="microsoft.jet.oledb.4.0;data source=c:/Inetpub/MyApp/data/database.mdb" /> ...
4
7865
by: Win, Pats | last post by:
I have a snippet of HTML that I inject into a number of pages throughout my Web site at runtime. My problem is that I'm not getting the image to appear in all documents into which this snippet is injected. If I specify a document-relative path (e.g., src="../someFolder/AnotherFolder/TheGraphic.gif"), then it works fine, but only for documents that exist at the level in the directory structure. I thought I could use a root-relative...
2
2307
by: Jordan Richard | last post by:
Put another way, is there any way I can tell ASP.NET to convert a path (imbedded in a string variable, "~/images/some_image.gif") to a root-relative path, that the client will understand, for the *current* page request? Here's what I'm doing: I am injecting HTML directly into ASPX pages via LiteralControl. something like this...
0
1087
by: matthias s. | last post by:
Hi there, Say I have a domain called www.mydomain.com. In my virtual directory I've created subfolders called 'sub1' and 'sub2'. Now in 'sub1 resides the file 'file1.aspx' and in 'sub2' resides the image 'img1.jpg'. When specifying a relative URL (to the image) in the file1.aspx I'd go like: <img src="../sub2/img1.jpg" /> and should be fine with it. My problem is, I have a couple of web-controls
19
5111
by: Jerry M. Gartner | last post by:
Greetings: What is the best way to resolve paths within a document regardless of what path it is opened under? For example: I have x.php and it contains <img src="images...">, (amongst other things, like php code), which resolves the correct image path when opened under / but when x.php is read into a file under /dir the image no longer resolves, for obvious reasons. With absolute paths, this isn't an issue but it is with relative...
2
10419
by: Ruymán | last post by:
Hello!, is possible use relative path in access? for example use "photo\image1.jpg" instead of "c:\db\photo\image1.jpg", I try it but I cann't, but in Visual Basic if is possible. Other question but relationated, Is posible don´t put a path to the picture in the image control (in desing) ? The Database will be move frecuntly and it will give error in the form load
5
1718
by: gunjangoyan | last post by:
Dear Friends , I am developing a cms like blog. http://domainname.com/blog/cmsindex.php and any template path are like blog/template/template_name/index.php In cmsindex.php i am using following code
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10225
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10053
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8880
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3969
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.