473,386 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

subdirectories in javascript

My question is the following:

I have a javascript that should open a page from a subdir on my website:
/image html/file.htm
It has to do this via a link: <A href="functionname('file.htm')
The problem is I can't find out what to put in front of the file name to
indicate that the file is in a subdirectory on the webserver.
I have tried ../subdir/file.htm and the entire url to the file but that
doesn't seem to work.
Does anyone know what I have to put in front of the file so that it wil be
opened from the subdirectory?

Thanks in advance

Jaap Zuidersma

Jul 23 '05 #1
9 2542
With:
* a folder called "MySite"
* a subfolder called "MySubFolder"
* a page in "MySite" called "MyPage.html"
* a page in "MySubFolder" called "MySubPage.html"
* a javascript function called "MyFunction" located inside
"MyPage.html"

( code below is untested )
The link inside "MyPage.html" should be either:

<A href="'MySubFolder/MySubPage.html'"
onclick="MyFunction('MySubFolder/MySubPage.html'); return 0;">

-or-

<A href="javascript:MyFunction('MySubPage.html');">

I prefer the first option because it will still take you to the page if
javascript isn't turned on...

Jul 23 '05 #2
jwade wrote:

Read this groups FAQ with regards to quoting what you are replying to.
With:
* a folder called "MySite"
* a subfolder called "MySubFolder"
* a page in "MySite" called "MyPage.html"
* a page in "MySubFolder" called "MySubPage.html"
* a javascript function called "MyFunction" located inside
"MyPage.html"

( code below is untested )
Then test it. Its not that difficult for the code you post.
The link inside "MyPage.html" should be either:

<A href="'MySubFolder/MySubPage.html'"
onclick="MyFunction('MySubFolder/MySubPage.html'); return 0;">
<a href="somePath/somePage.html" target="someWindow"
onclick="someFunction(this.href,this.target);retur n false">
-or-

<A href="javascript:MyFunction('MySubPage.html');">


It gets worse. Had you bothered to read this groups FAQ before posting
you would know the inherent problems with that construct, which go
beyond JS disabled.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
I should be more like Catherine Skidmore......
Jul 23 '05 #3
Jaap:
My first anchor should not have had the nested quotes in the href
attribute:
<A href="MySubFolder/MySubPage.h*tml"
onclick="MyFunction('MySubFold*er/MySubPage.html'); return 0;">

Randy:
Here's a tip: Don't be rude to someone who's being helpful. You could
have said "Please don't post code that is untested. By performing a
quick test we can signifcantly elevate the quality of information in
comp.lang.javascript."

I have read the FAQ and forgot the particular details about the
javascript: prefix. "Had you bothered" to enlighten us with your
wisdom or provide a relevant FAQ link, your first impression would not
have been "arrogant jerk".

Cheers! :D

Jul 23 '05 #4
Marlais wrote:
Jaap:
My first anchor should not have had the nested quotes in the href
attribute:
<A href="MySubFolder/MySubPage.h*tml"
onclick="MyFunction('MySubFold*er/MySubPage.html'); return 0;">

Randy:
Here's a tip: Don't be rude to someone who's being helpful.
Fair enough. The next time they are helpful, and not harmful, I will be
nice. I promise. <gag me with a spoon>
You could have said "Please don't post code that is untested. By
performing a quick test we can signifcantly elevate the quality of
information in comp.lang.javascript."
Yeah, I could have said that but I didn't. If people don't like my
answers, thats not my problem.

It is not my desire, my duty nor my obligation to "not be rude". It is
also not my desire to coddle people who can't handle reality. This is
Usenet, not a freaking paid help desk. If you want polite, pay for it.
Otherwise, deal with it and move on.
I have read the FAQ and forgot the particular details about the
javascript: prefix.
You evidently missed the beginning section where it covers quoting what
you are replying to?
"Had you bothered" to enlighten us with your wisdom or provide a
relevant FAQ link, your first impression would not have been "arrogant jerk".


Just so you don't whine anymore, the relevant FAQ link is section 2.3,
the first sentence:

<quote>
Before posting to clj, you should thoroughly read this document.
</quote>

But, if your first impression of me was "arrogant jerk", then my
impressionable skills have elevated. I typically don't rate that high an
impression, but life is a bitch.

Search the archives for Catherine Skidmore and you can find my
inspiration for answering some of the posts the way I do.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #5
On Sun, 15 May 2005 21:51:23 -0400, Randy Webb wrote:

To Randy,

I just popped in on this thread, since the topic looked interesting to me,
and as someone who uses these newsgroups very often for questions
regarding mysql, javascript, and PHP, I would like to make a comment.

First of all, what FAQ are you referring to? I am accessing this and all
other newsgroups with a free opensource program called PAN (made for
Linux, but nicely ported to windows) which gets me directly to the list of
posted headers and their bodies. I type in javascript, for example,
in the usergroup filter field, I get a list of groups with this
string in its name, and I just click on a group to download all
headers and then I can click on the header to see its body. I can
post by clicking on the Post or Reply buttons.

People who access these
forums like me don't get to see such things as FAQS. Just thought you
might want to be aware of this. If my way of accessing this newsgroup is
wrong, then the administrator of the newsgroup should do something about
it, like blocking non-logged in access somehow.

Secondly, if someone gave ME a tip that might help, but didn't have the
time or want to bother to test it, then that would be perfectly ok with me
- if the poster mentioned it was not tested.

Hope these news groups can be left as non-beaurocratic and as helpful as
they currently are!

- steve
Jul 23 '05 #6
coolsti <co*@goontrytospamme.com> writes:
To Randy,
Then it should have been a personal messag instead, so you'll have to
suffer me answering too :)
First of all, what FAQ are you referring to?
The FAQ for the newsgroup is available as a web page at
<URL:http://jibbering.com/faq/>. Some regualrs have a link to it in
their signature, and the rest of us just refer to it when applicable.

It is also posted in the group twice per week (according to the FAQ
itself, it should be Mondays and Fridays). Indeed, the most recent
posting was 13th of May:
<news:42***********************@news.zen.co.uk>
or if you can't look up by Message-Id:
<URL:http://groups-beta.google.com/group/comp.lang.javascript/msg/e3c4dae61594f93c>
I am accessing this and all other newsgroups with a free opensource
program called PAN (made for Linux, but nicely ported to windows)
which gets me directly to the list of posted headers and their
bodies.
You are using a news-reader. Good idea, so does most of the rest of
us, and we recommed it to the few who use web-based interfaces.

It is customary to recommend reading a group over a period of time
(either "lurking" for a while or just reading older messages) before
starting to post. It allows the newcomer to get a feeling for the tone
in the group, and it avoids (re)posting frequently asked questions,
where the answer is readily available.

Generally, Usenet groups often have a FAQ. You can pretty much assume
they do. The easiest place to find it is at the end of a Google search.

<URL:http://www.google.com/search?q=comp.lang.javascript+faq&btnI=I%27m%20Fee ling%20Lucky>
People who access these forums like me don't get to see such things
as FAQS.
Then they don't read the group before posting. It's unavoidable that
people not familiar with Usenet will also no be familiar with the
established etiquette. It'll change.
Just thought you might want to be aware of this. If my way
of accessing this newsgroup is wrong,
It's not
then the administrator of the newsgroup should do something about
it, like blocking non-logged in access somehow.
There are no administrators. The group comp.lang.javascript is a
non-moderated group, like most other Usenet groups. There is no
central access point that can be set to block access. Each ISP's
newsserver receives a feed of newsgroups from another server, and
propagates new messages back, in a big decentralized network ...
typically running over the internet.

Usenet is *old*, even older than the internet. In the beginning,
messages were propagated between US and Australia on magnetic tapes :)

Over time, a culture and etiquette has evolved. It's hard to say
exactly what it is, and each group has its own version of it.

For understanding Usenet, there are some links here:
<URL:http://burks.bton.ac.uk/burks/internet/usenet/>

Secondly, if someone gave ME a tip that might help, but didn't have the
time or want to bother to test it, then that would be perfectly ok with me
- if the poster mentioned it was not tested.
Sure. Happens all the time. I *ususally* remember writing that it
isn't tested. :)
Hope these news groups can be left as non-beaurocratic and as helpful as
they currently are!


One of the problems with being unmoderated, is that groups have to be
self policed. The regulars set the tone and try to keep it. Since being
a regular reader and poster of a newsgroup does not require pedagogical
training, some are better at doing this politely than others :)

Also, technical groups have a tendency to attract "geeks". It can give
a culture that can seem a little hostile to breaches of etiquette,
even when not intentional. While not necessarily as extreme as this
description, <URL:http://www.catb.org/~esr/faqs/smart-questions.html>,
it's a good read anyway :)
Good luck, and welcome :)
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #7
JRS: In article <pa****************************@goontrytospamme.co m>,
dated Mon, 16 May 2005 10:53:10, seen in news:comp.lang.javascript,
coolsti <co*@goontrytospamme.com> posted :
On Sun, 15 May 2005 21:51:23 -0400, Randy Webb wrote: First of all, what FAQ are you referring to?
He put the FAQ location in his signature; I expect that he thought that
doing so would suffice.
People who access these
forums like me don't get to see such things as FAQS.
The FAQ is posted (in two parts) three times a week. That should also
be enough.
If my way of accessing this newsgroup is
wrong, then the administrator of the newsgroup should do something about
it, like blocking non-logged in access somehow.
If your way is wrong, you should change to one which is right; or get
your administrator to put things right. You need us more than we need
you.
Hope these news groups can be left as non-beaurocratic and as helpful as
they currently are!


They are, however, resources best suited to those with perceptible
intelligence and incomplete ignorance.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #8
Before posting to clj, you should consider not taking a useful on-topic
thread and turning it into a piece of garbage (as you've done here).
As for your hero, Catherine Skidmore, this was the third post of hers I
came across:

From: Catherine Skidmore <e...@interport.net>
Subject: Re: Newbie question:
Date: 1998/07/01

Tim Moore wrote:

how do you create a link to the previous document without
using the back button/command.


<a href="javascript:history.back()">go back</a>

-catherine
--

Catherine Skidmore
http://www.suck-my-big.org
"You can kiss my ass and go straight to hell bitch." - danbel


Ironic, isn't it?

Jul 23 '05 #9
Marlais wrote:
Before posting to clj, you should consider not taking a useful on-topic
thread and turning it into a piece of garbage (as you've done here).
Nah, I don't care. It takes all the fun out of it.
As for your hero, Catherine Skidmore, this was the third post of hers I
came across:

From: Catherine Skidmore <e...@interport.net>
Subject: Re: Newbie question:
Date: 1998/07/01

Tim Moore wrote:
how do you create a link to the previous document without
using the back button/command.

<a href="javascript:history.back()">go back</a>

-catherine
--

Catherine Skidmore
http://www.suck-my-big.org
"You can kiss my ass and go straight to hell bitch." - danbel


Ironic, isn't it?


Irony is a plane full of convicts listening to a song made famous by a
band killed in a Plane Crash.

Second, no, it's not ironic that the third post from her would be date
in 1998 and use the most prevalent thinking at the time.

Third, you make the assumption that my replies at times are based on
Catherine's knowledge of the subject when it is not.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Jul 23 '05 #10

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

Similar topics

1
by: Thieum22 | last post by:
Hi, I try to go through a directory and it's subdirectories to reah the properties of each files. But I have a problem to set active the directory where the files are, in order to display their...
1
by: duane | last post by:
Dear Experts: I have a problem with my JS cookies. I am setting cookies in files located in two different directories, e.g. one in ROOT, one in ROOT/dir1/dir2. The cookies are then sent to PHP...
3
by: Brian F | last post by:
Ok here goes: WEBSITE main directory allows anonymous users fine. SITEA, SITEB, and SITEC are all subdirectories under WEBSITE that refer to graphics and javascript in the main virtual...
1
by: Benton | last post by:
Hi there, I want to have an unrestricted root directory and some protected subdirectories on my ASP.NET 2.0 application. I want each subdirectory to have its own Login.aspx page. The...
2
by: kamalak | last post by:
hi, can someone help me in writing code in C# for getting the no of files in a directory and all its subdirectories and their subdirectories where the no of subdirectories and their...
1
by: w33d5 | last post by:
I'm looking for a little help in making an index file to read the subdirectories in the same folder and display the links in a table. i am loading photo galleries using google's picasa onto my...
2
by: dj | last post by:
Hello All, I am attempting to us os.walk to populate two lists with values from a directory. The first list contains all the files in the directory and subdirectories. The second list contains...
4
by: Laharl | last post by:
My Operating Systems professor has assigned homework that basically boils down to implementing ls -lra, but with a different output format. In other words, list the files and subdirectories (and a...
10
by: beary | last post by:
Hello all, I've done something a bit stupid and am hoping some kind soul out there can help me out. There's a piece of code that goes through and creates a high number of subdirectories within...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...

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.