onmousedown hangs in Mozilla Help!

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

    #1

    onmousedown hangs in Mozilla Help!

    Hi,
    I'm trying to make it so when I click a image it prints out the image
    again and a load of other stuff. So far i've got this far.

    <html>
    <head>
    <script language="JavaS cript" type="">
    document.onmous edown = onmousedown;
    function onmousedown(e)
    {
    document.writel n("hello");
    }
    </script>
    </head>
    <body bgcolor="FFFFFF ">

    <img border="1" src="iecadaptor .jpg">

    </body>
    </html>

    but in Mozilla it prints out hello then hangs looking like it's doing
    something then I have to press back. In Explorer it works doesn't hang.
    Any ideas anyone why it's hanging in mozilla(linux)?
    Also if I change the document.writel n("hello"); to

    document.writel n("<img border="1" src="iecadaptor .jpg">");

    it doesn't print out an image just hangs in mozilla. Any ideas?

    Ideally I would like it so document.writel n doesn't have to reload to a
    new page and just uses a layer using <div stuff but that's next.

    Help anyone please

    Thanks

    Gary
  • Martin Honnen

    #2
    Re: onmousedown hangs in Mozilla Help!



    Gary Mayor wrote:
    [color=blue]
    > I'm trying to make it so when I click a image it prints out the image
    > again and a load of other stuff. So far i've got this far.
    >
    > <html>
    > <head>
    > <script language="JavaS cript" type="">
    > document.onmous edown = onmousedown;
    > function onmousedown(e)
    > {
    > document.writel n("hello");
    > }
    > </script>
    > </head>
    > <body bgcolor="FFFFFF ">
    >
    > <img border="1" src="iecadaptor .jpg">
    >
    > </body>
    > </html>
    >
    > but in Mozilla it prints out hello then hangs[/color]

    Well it is hanging there waiting for further document.write calls or a
    document.close( ) call.
    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    • Gary Mayor

      #3
      Re: onmousedown hangs in Mozilla Help!

      Martin Honnen wrote:[color=blue]
      >
      >
      > Gary Mayor wrote:
      >[color=green]
      >> I'm trying to make it so when I click a image it prints out the image
      >> again and a load of other stuff. So far i've got this far.
      >>
      >> <html>
      >> <head>
      >> <script language="JavaS cript" type="">
      >> document.onmous edown = onmousedown;
      >> function onmousedown(e)
      >> {
      >> document.writel n("hello");
      >> }
      >> </script>
      >> </head>
      >> <body bgcolor="FFFFFF ">
      >>
      >> <img border="1" src="iecadaptor .jpg">
      >>
      >> </body>
      >> </html>
      >>
      >> but in Mozilla it prints out hello then hangs[/color]
      >
      >
      > Well it is hanging there waiting for further document.write calls or a
      > document.close( ) call.[/color]

      Thank you very much the document.close( ) works a treat. Now I can figure
      out the rest.

      Cheers

      Comment

      • Michael Winter

        #4
        [OT] Re: onmousedown hangs in Mozilla Help!

        On Tue, 02 Mar 2004 15:39:31 +0000, Gary Mayor <gary@abertron. co.uk> wrote:
        [color=blue]
        > <script language="JavaS cript" type="">[/color]

        Don't do that. The type attribute should be used to specify the scripting
        language, not language (it is deprecated).

        <script type="text/javascript">

        is the correct way to write the tag (with optional src and defer
        attributes).

        Mike

        --
        Michael Winter
        M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)

        Comment

        • Ren Bruns

          #5
          Re: onmousedown hangs in Mozilla Help!

          A function cannot be named "onmousedow n" or "onMouseDow n" or anything
          that is already predefined in Javascript (that would rule out "write",
          "writeln", "replace", "length", "for", "if", etc..).
          [color=blue]
          > document.writel n("<img border="1" src="iecadaptor .jpg">");[/color]

          The quotations need to be "escaped," that is, it needs to be:
          document.writel n("<img border=\"1\" src=\"iecadapto r.jpg\">");

          If the quotes were not escaped, then it would be read as "<img
          border=" only and then an error would come saying something how the
          string wasn't concatenated properly.

          Gary Mayor <gary@abertron. co.uk> wrote in message news:<c229kq$3j 2$1@newsg2.svr. pol.co.uk>...[color=blue]
          > Hi,
          > I'm trying to make it so when I click a image it prints out the image
          > again and a load of other stuff. So far i've got this far.
          >
          > <html>
          > <head>
          > <script language="JavaS cript" type="">
          > document.onmous edown = onmousedown;
          > function onmousedown(e)
          > {
          > document.writel n("hello");
          > }
          > </script>
          > </head>
          > <body bgcolor="FFFFFF ">
          >
          > <img border="1" src="iecadaptor .jpg">
          >
          > </body>
          > </html>
          >
          > but in Mozilla it prints out hello then hangs looking like it's doing
          > something then I have to press back. In Explorer it works doesn't hang.
          > Any ideas anyone why it's hanging in mozilla(linux)?
          > Also if I change the document.writel n("hello"); to
          >
          > document.writel n("<img border="1" src="iecadaptor .jpg">");
          >
          > it doesn't print out an image just hangs in mozilla. Any ideas?
          >
          > Ideally I would like it so document.writel n doesn't have to reload to a
          > new page and just uses a layer using <div stuff but that's next.
          >
          > Help anyone please
          >
          > Thanks
          >
          > Gary[/color]

          Comment

          • Lasse Reichstein Nielsen

            #6
            Re: onmousedown hangs in Mozilla Help!

            ren_b@mac.com (Ren Bruns) writes:
            [color=blue]
            > A function cannot be named "onmousedow n" or "onMouseDow n" or anything
            > that is already predefined in Javascript (that would rule out "write",
            > "writeln", "replace", "length", "for", "if", etc..).[/color]

            Sure it can. "for" and "if" are keywords, and cannot be used for
            identifiers. The remaining are perfectly good names for functions
            (although one should be careful when using them, since they can
            conflict with other uses of the identifier).

            The following is perfectly legal and works (tested in IE6, Opera 7,
            Moz FB, and Netscape 4):

            <script type="text/javascript">
            function onMouseMove() {
            return onmousemove();
            }
            function onmousemove() {
            return writeln();
            }
            function writeln() {
            return write();
            }
            function write() {
            return replace();
            }
            function replace() {
            return length();
            }
            function length() {
            return 42;
            }
            alert(onMouseMo ve());
            </script>


            /L 'please don't top post'
            --
            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

            • Thomas 'PointedEars' Lahn

              #7
              Re: onmousedown hangs in Mozilla Help!

              Ren Bruns wrote:
              [color=blue]
              > A function cannot be named "onmousedow n" or "onMouseDow n" or anything
              > that is already predefined in Javascript (that would rule out "write",
              > "writeln", "replace", "length", "for", "if", etc..).[/color]

              Nonsense. Firstly, "onMouseDow n" is not defined in any common DOM.
              Secondly, a user-defined function *should* not have one of the mentioned
              identifiers (where "for" and "if" make an exception, see below).
              Depending on the used DOM, it nevertheless can and would thus overwrite
              the intrinsic method. Sometimes this is desired, e.g., when writing
              script that blocks popups. Thirdly, no user-defined token, including
              method identifiers, may be a reserved word, like "for" and "if".
              [color=blue][color=green]
              >> document.writel n("<img border="1" src="iecadaptor .jpg">");[/color]
              >
              > The quotations need to be "escaped," that is, it needs to be:
              > document.writel n("<img border=\"1\" src=\"iecadapto r.jpg\">");[/color]

              No, it needs not to be escaped. Fortunately, ECMAScript
              and implementations allow <'> for string delimiter:

              document.writel n('<img border="1" src="iecadaptor .jpg">');
              [color=blue]
              > [Top post][/color]

              Please do not do that, you are wasting precious resources.


              PointedEars

              Comment

              Working...