473,778 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="functionn ame('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 2566
With:
* a folder called "MySite"
* a subfolder called "MySubFolde r"
* a page in "MySite" called "MyPage.htm l"
* a page in "MySubFolde r" called "MySubPage.html "
* a javascript function called "MyFunction " located inside
"MyPage.htm l"

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

<A href="'MySubFol der/MySubPage.html' "
onclick="MyFunc tion('MySubFold er/MySubPage.html' ); return 0;">

-or-

<A href="javascrip t:MyFunction('M ySubPage.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 "MySubFolde r"
* a page in "MySite" called "MyPage.htm l"
* a page in "MySubFolde r" called "MySubPage.html "
* a javascript function called "MyFunction " located inside
"MyPage.htm l"

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

<A href="'MySubFol der/MySubPage.html' "
onclick="MyFunc tion('MySubFold er/MySubPage.html' ); return 0;">
<a href="somePath/somePage.html" target="someWin dow"
onclick="someFu nction(this.hre f,this.target); return false">
-or-

<A href="javascrip t:MyFunction('M ySubPage.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.javas cript 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="MySubFold er/MySubPage.h*tml "
onclick="MyFunc tion('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.javas cript."

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="MySubFold er/MySubPage.h*tml "
onclick="MyFunc tion('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.javas cript."
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.javas cript 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*@goontrytos pamme.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.u k>
or if you can't look up by Message-Id:
<URL:http://groups-beta.google.com/group/comp.lang.javas cript/msg/e3c4dae61594f93 c>
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.l ang.javascript+ faq&btnI=I%27m% 20Feeling%20Luc ky>
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.javas cript 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.u k/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/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #7
JRS: In article <pa************ *************** *@goontrytospam me.com>,
dated Mon, 16 May 2005 10:53:10, seen in news:comp.lang. javascript,
coolsti <co*@goontrytos pamme.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.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.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="javascrip t: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="javascrip t: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.javas cript 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
18068
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 properties. If anyone know how to improve my method, or know a better one, he's welcome :-) Thanks,
1
2501
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 file (server-side) which writes their values to a textfile, e.g. OUT.txt. The cookies that are in ROOT are working perfectly. No problem. The cookies set in ROOT/dir1/dir2, however, "seemed" to be set and read correctly, although
3
3793
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 directory. So we have the following structure. /WEBSITE /WEBSITE/images /WEBSITE/js /WEBSITE/SITEA/.....
1
2398
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 following article is a good start, but it uses a single Login.aspx located in the root directory to protect a subdirectory: http://www.theserverside.net/tt/articles/showarticle.tss?id=FormAuthentication
2
2511
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 subdirectories are not known. for example, to get the total no of files in C: or E: or so. thanks, kamala
1
1312
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 host and since picasa exports the albums as folders (I am using a simpleviewer template) i would like to use a script to read the subdirectories in the \photos directory (where the index file would also be located) and display the folders in a clean...
2
3800
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 only the files in the subdirectories. Here is the code: import os
4
7269
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 bit of data about them, for the files) in the current directory and its subdirectories using system calls. Unfortunately, it isn't working quite right. It works fine in the current directory, but when it goes into subdirectories, the stat() function...
10
2635
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 subdirectories, which is fine. Initially I forgot to create an index.html file in each directory to prevent viewing of its folders and files without people being logged in. I've fixed it now, but there are a whole heap of directories without this...
0
9465
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10296
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
10127
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...
1
10068
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7474
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
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
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
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2863
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.