Get Path?
Jul 23, 2005Is there a javascript variable that contains the path of the file from which
it ran?
Something like this....?
alert('My path=' + MyURLPath);
Is this possible?
Is there a javascript variable that contains the path of the file from which
it ran?
Something like this....?
alert('My path=' + MyURLPath);
Is this possible?
I'm using a script to include images into a slide show using direct URLs to the image files, but I am using fckeditor (PHP) for my users to edit their content. The script in the .js file that pulls the images into the slide show.The user's image file is going to be named something like, "userImage01.php". Inside that file would be their image location path ~ "images/user/image1.jpg".Therefore, I need the above javascript to pull-in "userImage01.php" INSTEAD OF the image's location path.
View 10 Replies View RelatedCan I subtract the filename form the location.pathname ex:
Before = 'file:///c:/afolder/awebsite.html'
After = 'file:///c:/afolder/'
Or is there any other way to get the directory without the name of the file being veiwed?
I have the following directory structure
index.jsp
a.js
b.js
|
|--/templates
|
|--/blah.jsp
Now blah .jsp is included INSIDE index.jsp.
In blah.jsp I have a button that calls a function inside b.js.
In index.jsp I have following code inside head tags:
<script src="a.js"></script>
<script src="b.js"></script>
and I figured since blah.jsp is included inside index.jsp, I should be
able to access the javascript methods with ease. But its not happening
that way. I get an error (object expected in the line that has button in
it). BTW, its not a problem in my JS or JSP code, because if I put the
js file's contents inside blah.jsp, then it works like a charm!
So what am I doing wrong?
I also tried moving my script import statements inside blah.jsp as:
<script src="../../a.js"></script>
<script src="../../b.js"></script>
But this doesn't seem to work either?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
i just wanted to retrieve path of a file residing on local client
system using javascript
I'm having an issue using .get and a callback. Basically, unlessI use a fully quantified path when I deploy my site the call doesn't work. When I'm developing on localhost, the site works fine. It's an ASP.NET MVC site. I'm fairly new to jQuery. If I replace the code with an absolute path, all seems fine. Obviously I'd rather use relative paths. I'd be grateful for any insight you could offer.
[Code]...
why my code not work, when I change path of xml?,
$.ajax({
type:"GET",
url:"testPathxml.xml",
dataType:"xml",
[Code]....
I can't figure out why I am not able to read the cookies sitewide, maybe it is the way I am setting the cookie but the cookie looks to be set correctly in the Firefox browser.
On the page that I set the cookie, it works. I can read the cookies I set on the same page as well.
If I move to another page to view the cookies it gives an undefined value when using the getCookie function.
IF the problem lies in the getCookie function, please explain the code a little to me so I can get an understanding what I missed.
Code:
I set the cookie with out the path. Is it OK to leave the path if you want the path to be "/"?
Code:
I see i firefox if I don't set the path , for path I get "/" ..Seems like default is "/" . Not sure if all browswe will set it to "/" by default?
i have this web application in which the user has to browse and select a folder but not file. i used <input type="file"> , which helps in retrieving only files.
View 3 Replies View RelatedI don't normally use Javascript apart from a few browser workarounds, but I have a requirement to set a country cookie and it was working when all my pages were in the same directory, but now that I've added subdirectories, it sets a new cookie for each directory instead of one sitewide.
Here's the code (which I edited from some found on the internet):
Then on the homepage links I use:
Then on the subdirectory pages, I have a reset button which allows you to return to the homepage and disable the redirect.
So I just need the path=/ to be added somewhere is that right? I tried changing the last line of the main code to:
1. I have some links that open with Javascript. The HTTP links work just fine, but I have one link that is supposed to open a picture in a new window. The picture is stored in the root/images folder. So it's supposed to be a relative path, but no matter what I do, I get an error page. (images/snailmail.jpg)
2. I have added a mouserollover funtion to change a small picture on the page. I am trying to add a second function to that function, to stop the scrollbar in the lower left corner as long as the mouse hovers over the picture. For the first picture, it works fine, but with the 2nd picture which allready has a mouseover function, I am not sure what to do.
I need to delete the path from certain files using js.
For instance
Change: images/icons/picture1.png
To: picture1.png
I love it. For a project I need help with parent data parsing.
<ul>
<li><a href="#">Option 1</a>
<ul>
[code]....
I would like to go to a url based on what the user selects from three seperate pull down menus.
Example user selects a product. Then selects a month and Selects a year.
month and year would join together Then create a path
<a href="product/month_year/DEFAULT.HTM">
I this possible with javascript.
In short, is there any way to have a js file know the location on the server where it is stored.. I can only find the domain/location of the current web page URI.
Explanation:
I have a bunch of javascript and php files that are in one location and are shared across a whole bunch of subdomains (each on their own folder on the root). I call the script through a "scripts" subdomain (this is so all the subdomains can access them in one shot).
A couple of the js files are ajax incorporated and I want to call a php script. Obviously, I can't call to the "scripts" subdomain, nor can I use the root webserver (as it is detected as the calling subdomains root). The only thing I can think of is if I can call the php file RELATIVE to the JS file... but all I can seem to get is RELATIVE to the calling script, which won't work since the js file won't know where it's being called from.
I am new to Javascript and I am sure that I just have a syntax error but can't find what it is.
I have an input form that accepts numbers. I am trying to compare the last field value to the current field value. My problem is that when I use a variable name of the last field, I get the error "null or not an object". The var 'L' is the problem. code...
I have a form item that uses file browse. It is returning full path and file name.ie. Z:imagesMyfile.JPGI want to always strip off the path (whatever it is) and get the filename only.ie. Myfile.JPG.I had used code below, but it only worked in IE. It needs to work in all browsers. ?
<script>
function xtractFile(data){
var m = data.match(/(.*)[/\]([^/\]+.w+)$/);
[code]....
I tried to add path to images but nothing i do seems to work. I dont know if im adding wrong code or not removing brackets or whatever but i cant get it to work. Please show me how the code should look so that i can get a better understanding of what m doing wrong. An example code of sorts. Thx.
[Code]...
In a parametric code i have to select which js file to load
but, even if the path string composition is right, the js file is not
executed.
See below:
<head>
.......
<script type="text/javascript">
var gal_num=parent.scelta;
var
gal_par_path=gal_path[gal_num]+"gallery"+gal_num+"/g"+gal_num+"_par.js";
</script>
<script type="text/javascript" src=gal_par_path></script>
</head>
I have tested the gal_par_path in the body, it looks right!
On the contrary, the file is executed if, instead of the local variable
i write it entirely.
I have a problem with an application i'm working on (Asp.net using
vb.net for developing). I'm normally used to doing middle tier
development, so my javascript skills are not up to par. Here is my problem:
I have a javascript file called 'PMP/Scripts/Popups.js' (pmp is the root
of the website). In that file is the following function:
function OpenTutorial(sTutID)
{
var sURL = '../support/tutorials.aspx?tutid=' = sTutID;
var sProperties = 'center:yes;etc..'
window.showModalDialog(sURL, self, sProperties);
}
where ../support is acutally pmp/support.
Most of the website pages are located in sub folders from the root of
the website. When editing is to be done on a record, a popup window is
called from the main page. the popup pages are in another sub folder
(i.e. pmp/review would be where review.aspx resides and the edit page
would be located at pmp/review/popups). We give the user a tutorial
icon to click on which calls the OpenTutorial function on a button click
event.
The problem is the tutorial popup page won't load properly when called
from another popup page. I've tried variations of location.href,
location.pathname, location.hostname etc.. but can't seem to get the
pages to open correctly. The most common error i get is that the url is
not correct. here is a sample of the urls being called by the function:
I am running my website using Weblogic, so the path is something like
http://<myip>:<port>/<servername>/
On JSP pages I can use <%=request.getContextPath()%to get the root
path of the site, ie that specified above. How can I get the same using
Javascript?
For example, something like <a href='/home'>..</awill not work as
that would point to http://<myip>:<port>/home and needs to point to
http://<myip>:<port>/<servername>/home
I'm currently at http://www.domain.com/the-path.jsp, and I would like
to be able, with JavaScript--and possibly the click of a button, which
I will most likely attach to IE's toolbar--transport to
http://domain.dev.domain.com/the-path.jsp.
Here's the environment: My browser is set to the page http://www.domain.com/the-path.jsp
and I plan to add a button to IE's toolbar via the registry that I
would like to execute the JavaScript, which contain the code to
perform the aforementioned procedure.
My JavaScript knowledge is, as I'm sure you've already surmised,
limited.
Here's what I know (or what I think I know)
The .js file header:
oShell= new
ActiveXObject("WScript.Shell");
the object: window.location.replace [or href].
I have a feeling a "and if" statement is needed here. Am I correct?
BTW: As far as the registry button addition is concerned, I'm set on
how to do that.
What I'd like to do is change the path to images with the class .changsrc. Eventually I'll attach this to a link, but for now I only need it to happen on page load. I managed to change the entire image src using attr() but that doesn't work for multiple images with one class name. (maybe I'm missing something there)So... how can I change
img src="images/imagename.jpg"
to:
img src="images/alt/imagename.jpg"
i want to load the content in the #contentscroll-div.at the leftmenu navigation all works fine with buttons and stuffthe headpic works fine eitherbut i wanted to have some links in my inner content (which is in #contentscroll-div). i gave them the class .contentlink and added the class to my click function. but it doesn't work.
$(document).ready(function()
{
$("#contentscroll").load("sites/home.html").fadeIn("slow");
[code]....
I need a way for a html page or something similar be able to determine what it's full path is. It must self-determine this. Any recommendations of what route I should take to figure this out?
View 2 Replies View Related