473,325 Members | 2,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

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:

http://www.miltonstreet.com/index2.html

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

[snip]

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

Sam
Jul 20 '05 #1
2 2722
Lee
Sam Carleton said:

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.


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.

Jul 20 '05 #2
Sam Carleton <sc**************@miltonstreet.com> writes:
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?
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:274px,height:336px,border:none">
<script type="text/javascript">
var HomepageImage = document.images['hpImage'];
HomepageImage.src = "images/RunningTheLine.jpg";;
</script>

There is no need for "TheImage"
Some background: My final objective is to have a web site where it
is VERY difficult to copy images off the site.
Give up. There is about a million ways to get it.
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.
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.
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.


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 - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: murali | last post by:
Hello everyone, I used absolute positioning with div tag in my website. The page looks cool as long as someone doesn't try to zoom in by increasing the text size (ctrl++ or thru changing font...
1
by: Stacey | last post by:
Hi, I'm hoping for a bit of advise-- I have a (relatively, from the point-of-view of this dilettante) complex script that attempts to preload certain images in order to trigger one of a series of...
4
by: Adrian MacNair | last post by:
Hi, I created an image gallery which displays 63 images in a slideshow. The problem is that the show was slow because each image loaded one at a time during the show. No problem right? I just...
4
by: VR | last post by:
Hi, I am trying to have a menu item (which is an HTML img) to change as a mouse moves over it. So, my code looks something like this: <a onmouseover="ActivateImage('MyImage');"...
3
by: Jeff | last post by:
I've been working on an application for a while now that has been giving me some trouble when it comes to working with a picturebox and memory usage. My company deals with digital imaging, so we...
2
by: Jean Pierre Daviau | last post by:
When I have something like this in a js file. listeImg = new Array(); listeImg = new Image(w,h); listeImg.src = "centre1.jpg"; etc Are the images loaded after the page is loaded? In the same...
0
by: speedcoder | last post by:
hi all, i'm stumped. my applet used to load images over the network. (it was actually designed by someone else.) yes, the applet used to load each image file independently over the network and...
1
by: agatha.life | last post by:
I did a javascript for the loading of images (I didn't want to have the images loaded in "on loading" because they are too many). The website is for a model and if you look at the codeof pages (...
1
by: mlikesit | last post by:
I am trying to get the following code to pre-load some images before re-dirrecting the user. The problem is that the onError event gets called for all of the images immediately. I've tripple...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.