subdirectories in javascript

J

Jaap Zuidersma

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
 
J

jwade

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...
 
R

Randy Webb

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);return 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.
 
M

Marlais

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
 
R

Randy Webb

Marlais said:
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. said:
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.
 
C

coolsti

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
 
L

Lasse Reichstein Nielsen

coolsti said:
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:
<or if you can't look up by Message-Id:
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.

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:
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
 
D

Dr John Stockton

JRS: In article <[email protected]>,
dated Mon, 16 May 2005 10:53:10, seen in
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.
 
M

Marlais

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 <[email protected]>
Subject: Re: Newbie question:
Date: 1998/07/01

Tim said:
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?
 
R

Randy Webb

Marlais said:
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 <[email protected]>
Subject: Re: Newbie question:
Date: 1998/07/01




<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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top