A probable solution perhaps?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Richard

    A probable solution perhaps?

    So sweet and simple.
    Found this script on a board.

    <script type="text/javascript">

    function showtext(thetex t) {
    if (!document.getE lementById) return false;
    document.getEle mentById("toggl e").innerHTM L = thetext;
    }
    </script>


    <a href="#" onClick="showte xt('text A'); return false">link 1</a> <br>
    <a href="#" onClick="showte xt('text B'); return false">link 2</a>
    <div id="toggle"></div>

    Question is, can I replace ("textA") with a variable like (text[1]) ??





  • Richard

    #2
    Re: A probable solution perhaps?

    On Sat, 22 Jan 2005 12:10:49 -0600 Richard wrote:
    [color=blue]
    > So sweet and simple.
    > Found this script on a board.[/color]
    [color=blue]
    > <script type="text/javascript">[/color]
    [color=blue]
    > function showtext(thetex t) {
    > if (!document.getE lementById) return false;
    > document.getEle mentById("toggl e").innerHTM L = thetext;
    > }
    > </script>[/color]

    [color=blue]
    > <a href="#" onClick="showte xt('text A'); return false">link 1</a> <br>
    > <a href="#" onClick="showte xt('text B'); return false">link 2</a>
    > <div id="toggle"></div>[/color]
    [color=blue]
    > Question is, can I replace ("textA") with a variable like (text[1]) ??[/color]


    The answer is YES!
    Works out so nicely I can now easily add descriptions with but a simple
    array.





    Comment

    • Michael Winter

      #3
      Re: A probable solution perhaps?

      On Sat, 22 Jan 2005 12:10:49 -0600, Richard <Anonymous@127. 001> wrote:
      [color=blue]
      > So sweet and simple.[/color]

      ....and completely inaccessible.

      [snip]

      Mike

      --
      Michael Winter
      Replace ".invalid" with ".uk" to reply by e-mail.

      Comment

      • Richard

        #4
        Re: A probable solution perhaps?

        On Sat, 22 Jan 2005 19:27:29 GMT Michael Winter wrote:
        [color=blue]
        > On Sat, 22 Jan 2005 12:10:49 -0600, Richard <Anonymous@127. 001> wrote:[/color]
        [color=blue][color=green]
        >> So sweet and simple.[/color][/color]
        [color=blue]
        > ...and completely inaccessible.[/color]

        I just tested it in IE6 and you are right, it does not work.
        So maybe I'll find something that will work in both then.
        I don't see why IE refuses it though.




        Comment

        • Michael Winter

          #5
          Re: A probable solution perhaps?

          On Sat, 22 Jan 2005 13:47:46 -0600, Richard <Anonymous@127. 001> wrote:
          [color=blue]
          > On Sat, 22 Jan 2005 19:27:29 GMT Michael Winter wrote:[/color]

          [snip]
          [color=blue][color=green]
          >> [...] completely inaccessible.[/color]
          >
          > I just tested it in IE6 and you are right, it does not work.[/color]

          Whether something "works" has nothing to do with its accessibility.

          The fact that such an approach relies on a script to provide content
          (completely unnecessarily, I might add) makes it unsuitable for the Web in
          general as only scriptable browsers (that support innerHTML) can make
          sense of the document.

          [snip]

          Mike

          --
          Michael Winter
          Replace ".invalid" with ".uk" to reply by e-mail.

          Comment

          • Richard

            #6
            Re: A probable solution perhaps?

            On Sat, 22 Jan 2005 20:35:59 GMT Michael Winter wrote:
            [color=blue]
            > On Sat, 22 Jan 2005 13:47:46 -0600, Richard <Anonymous@127. 001> wrote:[/color]
            [color=blue][color=green]
            >> On Sat, 22 Jan 2005 19:27:29 GMT Michael Winter wrote:[/color][/color]
            [color=blue]
            > [snip][/color]
            [color=blue][color=green][color=darkred]
            >>> [...] completely inaccessible.[/color][/color][/color]
            [color=blue][color=green]
            >> I just tested it in IE6 and you are right, it does not work.[/color][/color]
            [color=blue]
            > Whether something "works" has nothing to do with its accessibility.[/color]
            [color=blue]
            > The fact that such an approach relies on a script to provide content
            > (completely unnecessarily, I might add) makes it unsuitable for the Web
            > in
            > general as only scriptable browsers (that support innerHTML) can make
            > sense of the document.[/color]
            [color=blue]
            > [snip][/color]

            Then why do we even have damn browsers if all they will do is render html?
            The content presented in my case is not all that necessary, it is purely for
            providing a short description of the image.
            Of course, I could use a flaky tool tip thingy, but even that is crap.
            I am looking at doing this in a bit more professional way.

            During my surfing session today, I did run across one site which does
            precisely what I want to do.
            Where they had the main content swap in accordance with your choice from a
            dropdown box.
            But I couldn't figure out how they addressed the script page.


            Comment

            • Hywel Jenkins

              #7
              Re: A probable solution perhaps?

              In article <csv74601es6@ne ws1.newsguy.com >, Anonymous@127.0 01 says...[color=blue]
              > On Sat, 22 Jan 2005 20:35:59 GMT Michael Winter wrote:
              >[color=green]
              > > On Sat, 22 Jan 2005 13:47:46 -0600, Richard <Anonymous@127. 001> wrote:[/color]
              >[color=green][color=darkred]
              > >> On Sat, 22 Jan 2005 19:27:29 GMT Michael Winter wrote:[/color][/color]
              >[color=green]
              > > [snip][/color]
              >[color=green][color=darkred]
              > >>> [...] completely inaccessible.[/color][/color]
              >[color=green][color=darkred]
              > >> I just tested it in IE6 and you are right, it does not work.[/color][/color]
              >[color=green]
              > > Whether something "works" has nothing to do with its accessibility.[/color]
              >[color=green]
              > > The fact that such an approach relies on a script to provide content
              > > (completely unnecessarily, I might add) makes it unsuitable for the Web
              > > in
              > > general as only scriptable browsers (that support innerHTML) can make
              > > sense of the document.[/color]
              >[color=green]
              > > [snip][/color]
              >
              > Then why do we even have damn browsers if all they will do is render html?[/color]

              That's what browsers are for, Stupid.
              [color=blue]
              > The content presented in my case is not all that necessary[/color]

              Agreed.

              [color=blue]
              > Of course, I could use a flaky tool tip thingy, but even that is crap.[/color]

              You're used to producing crap aren't you, Bullis?

              [color=blue]
              > I am looking at doing this in a bit more professional way.[/color]

              ROTFLMAO!

              --
              Hywel http://kibo.org.uk/
              I do not eat quiche.

              Comment

              • Evertjan.

                #8
                Re: A probable solution perhaps?

                Hywel Jenkins wrote on 23 jan 2005 in comp.lang.javas cript:
                [color=blue][color=green]
                >> Then why do we even have damn browsers if all they will do is render
                >> html?[/color]
                >
                > That's what browsers are for, Stupid.
                >[/color]

                My IE6 happily shows a text-file, like <http://x.com/y.txt>

                IE will also forward specific files to it's specialized programme,
                like Realplayer, windowsmediapla yer, adobeviewer,
                or plugins,
                like flash, etc.

                btw "rendering" [extract to,deliver to,depict as,translate into]
                in the html sense is more a serverside code action IMHO.

                --
                Evertjan.
                The Netherlands.
                (Replace all crosses with dots in my emailaddress)

                Comment

                • Richard Cornford

                  #9
                  Re: A probable solution perhaps?

                  Richard (RtS) wrote:[color=blue]
                  > Michael Winter wrote:[/color]
                  <snip>[color=blue][color=green]
                  >> ... makes it unsuitable for the Web in general as only
                  >> scriptable browsers (that support innerHTML) can make
                  >> sense of the document.[/color]
                  >
                  > Then why do we even have damn browsers if all they
                  > will do is render html?[/color]

                  The minimum requirement for a web browser is that it be able to retrieve
                  an HTML document and (in some sense) present its contents to the user.
                  If it cannot do that then it is not a web browser, but if it does
                  anything more then that is an optional extra. Making accessing content
                  dependent upon optional technologies is a mistake, and a demonstrably
                  avoidable mistake at that.
                  [color=blue]
                  > The content presented in my case is not all that
                  > necessary, it is purely for providing a short description
                  > of the image.[/color]
                  [color=blue]
                  > Of course, I could use a flaky tool tip thingy, but even
                  > that is crap.[/color]

                  Apparently that is not true as you have manifestly failed to
                  successfully implement even one of the copy-and-paste scripts that you
                  have been trying to use, and trying to adopt scripts that were not
                  designed for copy-and-paste (copyright issues not withstanding) was
                  never a viable activity as that will always require a real understanding
                  of browser scripting.
                  [color=blue]
                  > I am looking at doing this in a bit more professional way.[/color]

                  A professional presented with a problem outside of their skill-set will
                  either: 1. Acquire then necessary skills. 2. Hire the services of
                  another professional who already has those skills. Usually the latter as
                  the former is too time consuming to address most current problems (but
                  might still be seen as an appropriate course of action in anticipation
                  of similar problems occurring in the future).

                  What a professional will not do is spend two months spinning their
                  wheels looking for some sort of panacea script on the internet, the
                  implementation of which, if ever found, would be beyond them anyway.

                  One of the things that makes you intermittently posted, self satisfied
                  "progress" reports particularly unwelcome is that everyone reading them
                  knows that you are progressing from nothing, towards nothing. Your whole
                  approach is fatally flawed; you cannot successfully use scripting on the
                  Internet without first acquiring the pertinent skills, and you haven't
                  even grasped HTML yet let alone the added complexity of perceiving the
                  additional mechanism involved in scripting.
                  [color=blue]
                  > During my surfing session today, I did run across one
                  > site which does precisely what I want to do.
                  > Where they had the main content swap in accordance with
                  > your choice from a dropdown box.[/color]

                  Yes, it is trivial to do it. The only significant issues are designing
                  the script so that it does not introduce unnecessary dependencies, and
                  is reliable in its execution or clean degradation.
                  [color=blue]
                  > But I couldn't figure out how they addressed the script page.[/color]

                  When conversing with people who have (at best) a slight understanding of
                  a technical subject throwing in a little tech-speek might impress. In
                  the context of a technical newsgroup the misuse of technical language
                  will only make it obvious that you don't know what you are talking
                  about, but are trying (for some unfathomable reason) to pretend
                  otherwise.

                  It is not "how they address the scripted page" that you could not figure
                  out (that is a meaningless statement). What you cannot figure out is;
                  what it is that you need to be able to figure out. And that is because
                  you have not yet grasped the basics of the subject, though you appear to
                  also be incapable of perceiving that.

                  To script a web browser for the internet you first need to know (at
                  minimum):-

                  1. The basic syntax and use of javascript (and eventually the details,
                  if you every hope to take full advantage of the language).

                  2. The browser object model; its structure and behaviour. (For which it
                  is necessary to understand how the DOM relates to (x)HTML source code.
                  Which, in turn requires a technical understanding of HTML.)

                  3. The differences between, and variability in, browser object models,
                  and the techniques for handling those differences.

                  4. The issues pertinent to web browser scripting; reliability, clean
                  degradation, accessibility, etc, etc.

                  From that basis you can move on to the bigger problems of script design
                  for the Internet, and so be in a position to produce something worth
                  talking about.

                  From your current position of having no comprehension of any of the
                  above, and apparently no interest in (or talent for) learning about
                  them, you can only waste your time. Which is fine, so long as you don't
                  bother anyone else with your nonsense.

                  Richard.


                  Comment

                  • Dr John Stockton

                    #10
                    Re: A probable solution perhaps?

                    JRS: In article <csu4vh01j93@ne ws1.newsguy.com >, dated Sat, 22 Jan 2005
                    12:10:49, seen in news:comp.lang. javascript, Richard <Anonymous@127. 001>
                    posted :[color=blue]
                    >So sweet and simple.
                    >Found this script on a board.[/color]

                    You should have left it there.

                    [color=blue]
                    >function showtext(thetex t) {
                    >if (!document.getE lementById) return false;
                    >document.getEl ementById("togg le").innerHTM L = thetext;
                    >}[/color]

                    That function returns either false or undefined; that's not a well-
                    designed combination.

                    In reading recent articles in this newsgroup, you should have seen a
                    thread containing

                    if (document.all && !document.getEl ementById) {
                    document.getEle mentById = function(id) {
                    return document.all[id] } }

                    If that code is executed before showtext is called, showtext will work
                    equally well in older versions of MSIE, under reasonable assumptions
                    about "toggle".

                    For versatility, supply the location as a parameter to showtext.

                    The code can then be put in an include file, and used on various pages.

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

                    Comment

                    Working...