problems loading images...

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

    problems loading images...

    I feel like a complete fool! I should know the answer to the Q:

    How do I load an image with JS and replace the default image?

    Some background: My final objective is to have a web site where it
    is VERY difficult to copy images off the site. The first thing I
    was going to do was force folks to turn on JavaScript so that I
    could disable the right click pop up menu. To force this, I thought
    I would have all the default images say that JavaScript is required
    to view the images. The problem is that I cannot figure out for the
    world in me how to load the good image. The page can be found here:



    here are the code snips:
    ------------------------------------------------
    [snip]
    <body bgcolor="#FFFFF F">
    <script language="JavaS cript1.1">
    <!--
    TheImage = new Image();
    TheImage.src = "images/RunningTheLine. jpg";
    HomepageImage = document.images['hpImage'];
    HomepageImage.s rc = TheImage.src;
    //-->
    </script>

    [snip]

    <img name="hpImage" src="images/njs-228x280.jpg" width="274"
    height="336" border="0">
    ------------------------------------------------

    Sam
  • Lee

    #2
    Re: problems loading images...

    Sam Carleton said:[color=blue]
    >
    >I feel like a complete fool! I should know the answer to the Q:
    >
    >How do I load an image with JS and replace the default image?
    >
    >Some background: My final objective is to have a web site where it
    >is VERY difficult to copy images off the site. The first thing I
    >was going to do was force folks to turn on JavaScript so that I
    >could disable the right click pop up menu. To force this, I thought
    >I would have all the default images say that JavaScript is required
    >to view the images.[/color]

    You can't disable the right click menu reliably. Certainly
    not in all browsers. If your page contains the URL of the
    actual images, I can view the source and copy the URL into
    the browser's location field. If I didn't feel like doing
    that, I could simply do a screen capture, or copy the images
    out of my cache.

    Comment

    • Lasse Reichstein Nielsen

      #3
      Re: problems loading images...

      Sam Carleton <scarleton-nospam@miltonst reet.com> writes:
      [color=blue]
      > I feel like a complete fool! I should know the answer to the Q:
      >
      > How do I load an image with JS and replace the default image?[/color]

      What you have should work *if* it is executed after the *image* tag has
      been parsed.

      <img id="hpImage" src="images/njs-228x280.jpg"
      style="width:27 4px,height:336p x,border:none">
      <script type="text/javascript">
      var HomepageImage = document.images['hpImage'];
      HomepageImage.s rc = "images/RunningTheLine. jpg";;
      </script>

      There is no need for "TheImage"


      [color=blue]
      > Some background: My final objective is to have a web site where it
      > is VERY difficult to copy images off the site.[/color]

      Give up. There is about a million ways to get it.
      [color=blue]
      > The first thing I was going to do was force folks to turn on
      > JavaScript so that I could disable the right click pop up menu.[/color]

      Doesn't work in my browser. Doesn't prevent me from turning JS off
      after the page has loaded. Doesn't stop me from using "Save with
      imags". Doesn't stop me from finding the URL in the JS and loading
      the image directly. Doesn't stop me from using a TCP snooper with
      connection streaming to save the image.
      [color=blue]
      > To force this, I thought I would have all the default images say
      > that JavaScript is required to view the images. The problem is that
      > I cannot figure out for the world in me how to load the good image.[/color]

      So your page only works with Javascript available, only because you
      want to protect your images (which doesn't work). Since not all
      browsers *can* turn Javascript on, some people can't use your page.

      Your page would be better and more user friendly if you spend your
      energy on making it more accessible, not less.

      Oh yes, and validate your code. You'll probably be surpriced.
      /L
      --
      Lasse Reichstein Nielsen - lrn@hotpop.com
      Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
      'Faith without judgement merely degrades the spirit divine.'

      Comment

      Working...