Loading ...
Sorry, an error occurred while loading the content.

image question

Expand Messages
  • Lpais
    Could someone tell me what I am doing wrong here? I am trying to assign an image to a variable but it is not working: if(file.endsWith( .html ) ||
    Message 1 of 2 , Apr 29, 2002
    • 0 Attachment
      Could someone tell me what I am doing wrong here?

      I am trying to assign an image to a variable but it is not working:

      if(file.endsWith(".html") || file.endsWith
      (".HTML"))
      {
      newimage="/images/icon_ie.gif";
      }
      if(file.endsWith(".txt") || file.endsWith
      (".TXT"))
      {
      newimage="";
      }
      if(file.endsWith(".pdf") || file.endsWith
      (".PDF"))
      {
      newimage="pdf";
      }

      All it is doing is showing the oath and not the image.

      Thank you in advance
      Lance
    • john041650
      hi Lance, I m not the sharpest pencil in the drawer when it comes to JavaScript, but no one else has taken a stab at your problem yet, so I ll try.. I do not
      Message 2 of 2 , May 2, 2002
      • 0 Attachment
        hi Lance,

        I'm not the sharpest pencil in the drawer when it comes to JavaScript, but no one else has taken a stab at your problem yet, so I'll try..

        I do not understand what you're trying to do here other than to assign an image to a variable. Below is a snippet of code I've used in the Head section to preload a couple Gif bullets that I use with mouseovers.

        <script type="text/javascript" language="JavaScript">
        <!-- ;
        // Preloader
        ledoff = new Image(15,15);
        ledoff.src = "bullet0.gif";
        ledgrn = new Image(15,15);
        ledgrn.src = "bulletg.gif";
        // end hide -->
        </script>

        Then in the Body section, I'll put the default bullet image where I want using code similar to the below:

        <img src="bullet0.gif" width="15" height="15" name="item0" alt="">

        And call for the image to change with a link similar to the one below.

        <a href="link.htm" onmouseover="item0.src=ledgrn.src" onmouseout="item0.src=ledoff.src">Click Me</a>

        Sorry if this isn't any help, it's the closest thing to an answer to your problem I could come up with.

        John






        --- In ntb-html@y..., "Lpais" <lpais@y...> wrote:
        > Could someone tell me what I am doing wrong here?
        >
        > I am trying to assign an image to a variable but it is not working:
        >
        > if(file.endsWith(".html") || file.endsWith
        > (".HTML"))
        > {
        > newimage="/images/icon_ie.gif";
        > }
        > if(file.endsWith(".txt") || file.endsWith
        > (".TXT"))
        > {
        > newimage="";
        > }
        > if(file.endsWith(".pdf") || file.endsWith
        > (".PDF"))
        > {
        > newimage="pdf";
        > }
        >
        > All it is doing is showing the oath and not the image.
        >
        > Thank you in advance
        > Lance
      Your message has been successfully submitted and would be delivered to recipients shortly.