Optimize My Javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dennis M. Marks

    Optimize My Javascript

    I create most of my javascripts by modifying others, therefore, I do
    not have a vast knowledge of it and my question may seem trivial but
    please help me.

    If you go to my page http://www.dcs-chico.com/~denmarks/relative.html
    you can see a simple script that uses the index returned from two pull
    down menus to extract text from a table. I am looking for the best way
    to display the result. I am currently using a text input form which
    works but does not seem to be the best option. I would rather just have
    the text appear directly on the page (without redrawing the page) and
    not within a text box. Another problem is that even though the box is
    read only, if someone places the curser in the box and presses return a
    file not found message appears.

    --
    Dennis M. Marks
    Do not reply with e-mail to yahoo. I do not monitor mailbox. It is for
    collecting spam.
    You can use the following address (rot 13) qraznexf@qpfv.a rg


    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
  • Lasse Reichstein Nielsen

    #2
    Re: Optimize My Javascript

    "Dennis M. Marks" <denmarks@yahoo .com> writes:
    [color=blue]
    > If you go to my page http://www.dcs-chico.com/~denmarks/relative.html[/color]
    ....
    [color=blue]
    > I am currently using a text input form which works but does not seem
    > to be the best option. I would rather just have the text appear
    > directly on the page (without redrawing the page) and not within a
    > text box.[/color]

    I think it looks fine. It is also the most compatible way of adding
    information to a page. Other methods are:
    - Netscape 4 layers
    - IE 4+ innerHTML
    - W3C DOM node manipulation (IE 5+,Mozilla, Opera 7, etc.)
    - Iframe and document.write to it (don't know exactly which browsers).
    No browser supports all of these, and none of these methods are supported
    by all browsers.
    Using a text input element works in all of these browser and more. In
    some browsers, it is the *only* way to add content after the page has
    loaded.
    So, if you really want to use another method, you must tell us which
    browsers needs to be supported. Then we can tell you how to do it.
    (There is something about it in the FAQ too:
    <URL:http://jibbering.com/faq/#FAQ4_15>)

    If it looks so bad, style it:
    <style type="text/css">
    #output {
    background: #0ff;
    border:0px solid #0ff;
    font: inherit;
    }
    </style>
    and give the output field id="output". That should make it look like normal
    text in those browsers that allow it.
    [color=blue]
    > Another problem is that even though the box is read only,
    > if someone places the curser in the box and presses return a file
    > not found message appears.[/color]

    Your form element is generally not necessary if you don't want to
    submit the form anyway. However, Netscape 4 only allows form controls
    inside a form element, and it makes addressing the controls much easier.

    A typical sign that you don't use the form element for submitting is
    that you don't know what to write in the "action" attribute. You have
    written "post", which should really be in the "method" attribute. The
    "action" attribute should contain an URL.

    If you don't have access to server side scripting, so you could make
    the application work even if the client have no Javascript available,
    I would let the "action" URL point to a page that explains that the
    page needs Javascript to work. Then I would add an onsubmit handler
    that prevented the form from being submitted if Javascript is available.
    I.e.,
    <form id="form" name="form"
    method="post" action="noJS.ht ml" onsubmit="retur n false">

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Dennis M. Marks

      #3
      Re: Optimize My Javascript

      In article <d6co49p9.fsf@h otpop.com>, Lasse Reichstein Nielsen
      <lrn@hotpop.com > wrote:

      <SNIP>[color=blue]
      > I think it looks fine. It is also the most compatible way of adding
      > information to a page. Other methods are:
      > - Netscape 4 layers
      > - IE 4+ innerHTML
      > - W3C DOM node manipulation (IE 5+,Mozilla, Opera 7, etc.)
      > - Iframe and document.write to it (don't know exactly which browsers).
      > No browser supports all of these, and none of these methods are supported
      > by all browsers.
      > Using a text input element works in all of these browser and more. In
      > some browsers, it is the *only* way to add content after the page has
      > loaded.
      > So, if you really want to use another method, you must tell us which
      > browsers needs to be supported. Then we can tell you how to do it.
      > (There is something about it in the FAQ too:
      > <URL:http://jibbering.com/faq/#FAQ4_15>)
      >[/color]
      <SNIP>

      Thanks, that helped a lot.

      --
      Dennis M. Marks
      Do not reply with e-mail to yahoo. I do not monitor mailbox. It is for
      collecting spam.
      You can use the following address (rot 13) qraznexf@qpfv.a rg


      -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
      http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
      -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

      Comment

      Working...