subdirectories in javascript

Discussion in 'Javascript' started by Jaap Zuidersma, May 15, 2005.

  1. 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
     
    Jaap Zuidersma, May 15, 2005
    #1
    1. Advertising

  2. Jaap Zuidersma

    jwade Guest

    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...
     
    jwade, May 15, 2005
    #2
    1. Advertising

  3. Jaap Zuidersma

    Randy Webb Guest

    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.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    I should be more like Catherine Skidmore......
     
    Randy Webb, May 15, 2005
    #3
  4. Jaap Zuidersma

    Marlais Guest

    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
     
    Marlais, May 15, 2005
    #4
  5. Jaap Zuidersma

    Randy Webb Guest

    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
     
    Randy Webb, May 16, 2005
    #5
  6. Jaap Zuidersma

    coolsti Guest

    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
     
    coolsti, May 16, 2005
    #6
  7. coolsti <> 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:428495d6$0$20983$>
    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%20Feeling%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 -
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, May 16, 2005
    #7
  8. JRS: In article <>,
    dated Mon, 16 May 2005 10:53:10, seen in news:comp.lang.javascript,
    coolsti <> 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.
     
    Dr John Stockton, May 16, 2005
    #8
  9. Jaap Zuidersma

    Marlais Guest

    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 <>
    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?
     
    Marlais, May 17, 2005
    #9
  10. Jaap Zuidersma

    Randy Webb Guest

    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 <>
    > 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?
     
    Randy Webb, May 17, 2005
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thieum22
    Replies:
    1
    Views:
    685
    Joe Smith
    Aug 6, 2004
  2. Steve Haun
    Replies:
    0
    Views:
    448
    Steve Haun
    Nov 16, 2003
  3. =?Utf-8?B?Q2hhcmxpZSBEaXNvbg==?=

    Organizing pages in subdirectories of main directory

    =?Utf-8?B?Q2hhcmxpZSBEaXNvbg==?=, Feb 8, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    389
    Yan-Hong Huang[MSFT]
    Feb 9, 2004
  4. Stefan Rosi

    referencing an assembly in subdirectories

    Stefan Rosi, Jun 4, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    362
    Stefan Rosi
    Jun 4, 2004
  5. duane
    Replies:
    1
    Views:
    86
    Janwillem Borleffs
    Sep 18, 2003
Loading...

Share This Page