473,386 Members | 1,819 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,386 software developers and data experts.

Anybody see why this is not working!

Hi, I cliped this and mofified it to be used in a mouse_over to change
the background of text. This is supposed to pre-load the image on
mouse over but it don't!

<script language="Javascript">

function ImgPreLoad()
{
var my_images_array = new Array ('ltrhome.jpg', 'ltrabout',
ltrphoto.jpg', 'ltrmap.jpg', 'ltreq.jpg', 'ltcont.jpg');
LoadmUp (my_images);

}

function LoadmUp (my_images_array)
{
for (loop = 0; loop < my_images_array.length; loop++)
{
var one_image = new Image();
one_image.src = my_images_array[loop];
}
}

</script>

Aug 9 '07 #1
3 1210
Mr.G (@¿@) wrote on 09 aug 2007 in comp.lang.javascript:
Hi, I cliped this and mofified it to be used in a mouse_over to change
the background of text. This is supposed to pre-load the image on
mouse over but it don't!

<script language="Javascript">
You cliped [?] from last century, nowadays use:
<script type='text/javascript'>
function ImgPreLoad()
{
var my_images_array = new Array ('ltrhome.jpg', 'ltrabout',
ltrphoto.jpg', 'ltrmap.jpg', 'ltreq.jpg', 'ltcont.jpg');
ltrabout? that an image name?

You do not need a function to decalre an array.
LoadmUp (my_images);
Unknown parameter my_images
>
}

function LoadmUp (my_images_array)
Never reuse a variable name a a parameter, You will make mistakes.

Now my_images_array is not an array but ponts to the undeclared variable
named my_images. That should give an error!
{
for (loop = 0; loop < my_images_array.length; loop++)
(var loop = ....

my_images_array.length: undeclared variables have no length.
{
var one_image = new Image();
one_image.src = my_images_array[loop];
not an array.
}
}

You do not need a function for preloading.
>
</script>
The reason you get no error could be
that you do not call ImgPreLoad().

===========================================

Try:

<script type='text/javascript'>
var oneImage;
var myImagesArray = ['ltrhome.jpg','ltrabout.gif','ltrphoto.jpg'];
for (var i = 0; i < myImagesArray.length; i++) {
oneImage = new Image();
oneImage.src = myImagesArray[i];
};
</script>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 9 '07 #2
On Aug 9, 10:49 am, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
Mr.G (@¿@) wrote on 09 aug 2007 in comp.lang.javascript:
Hi, I cliped this and mofified it to be used in a mouse_over to change
the background of text. This is supposed to pre-load the image on
mouse over but it don't!
<script language="Javascript">

You cliped [?] from last century, nowadays use:
<script type='text/javascript'>
function ImgPreLoad()
{
var my_images_array = new Array ('ltrhome.jpg', 'ltrabout',
ltrphoto.jpg', 'ltrmap.jpg', 'ltreq.jpg', 'ltcont.jpg');

ltrabout? that an image name?

You do not need a function to decalre an array.
LoadmUp (my_images);

Unknown parameter my_images
}
function LoadmUp (my_images_array)

Never reuse a variable name a a parameter, You will make mistakes.

Now my_images_array is not an array but ponts to the undeclared variable
named my_images. That should give an error!
{
for (loop = 0; loop < my_images_array.length; loop++)

(var loop = ....

my_images_array.length: undeclared variables have no length.
{
var one_image = new Image();
one_image.src = my_images_array[loop];

not an array.
}
}

You do not need a function for preloading.
</script>

The reason you get no error could be
that you do not call ImgPreLoad().

===========================================

Try:

<script type='text/javascript'>
var oneImage;
var myImagesArray = ['ltrhome.jpg','ltrabout.gif','ltrphoto.jpg'];
for (var i = 0; i < myImagesArray.length; i++) {
oneImage = new Image();
oneImage.src = myImagesArray[i];};

</script>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
I need to try that thanks, goodm

Aug 15 '07 #3
On Aug 9, 10:49 am, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
Mr.G (@¿@) wrote on 09 aug 2007 in comp.lang.javascript:
Hi, I cliped this and mofified it to be used in a mouse_over to change
the background of text. This is supposed to pre-load the image on
mouse over but it don't!
<script language="Javascript">

You cliped [?] from last century, nowadays use:
<script type='text/javascript'>
function ImgPreLoad()
{
var my_images_array = new Array ('ltrhome.jpg', 'ltrabout',
ltrphoto.jpg', 'ltrmap.jpg', 'ltreq.jpg', 'ltcont.jpg');

ltrabout? that an image name?

You do not need a function to decalre an array.
LoadmUp (my_images);

Unknown parameter my_images
}
function LoadmUp (my_images_array)

Never reuse a variable name a a parameter, You will make mistakes.

Now my_images_array is not an array but ponts to the undeclared variable
named my_images. That should give an error!
{
for (loop = 0; loop < my_images_array.length; loop++)

(var loop = ....

my_images_array.length: undeclared variables have no length.
{
var one_image = new Image();
one_image.src = my_images_array[loop];

not an array.
}
}

You do not need a function for preloading.
</script>

The reason you get no error could be
that you do not call ImgPreLoad().

===========================================

Try:

<script type='text/javascript'>
var oneImage;
var myImagesArray = ['ltrhome.jpg','ltrabout.gif','ltrphoto.jpg'];
for (var i = 0; i < myImagesArray.length; i++) {
oneImage = new Image();
oneImage.src = myImagesArray[i];};

</script>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
wow that worked really well!!!
Like I said I nipped it from some tutorial on progrming in javascrip
but it didn't work. They loaded only after the mouse was over the
image. But now thanks to you they are changing as soon as the mouse is
over. thanks again!

Aug 15 '07 #4

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

Similar topics

0
by: Dorthe Luebbert | last post by:
Hi, there is a new(er) version of John McNammara's Excel package for Perl: http://homepage.eircom.net/~jmcnamara/perl/prerel/Spreadsheet-WriteExcel-0.49.7.tar.gz The package writes Excel97...
5
by: clintonG | last post by:
Neither MSDN code examples nor will function. Has anybody figured out how to use the 2.0 classes, methods and properties to dynamically create HTML in the HTML <head> element? I've burned...
4
by: Simon Verona | last post by:
I'm using wia in a vb.net project to capture images from a scanner.. This works fine. However, I want to control the way that images are scanned - ie B+W, Greyscale and resolution etc, but can't...
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
3
by: DurumDara | last post by:
Hi ! I need to speedup my MD5/SHA1 calculator app that working on filesystem's files. I use the Python standard modules, but I think that it can be faster if I use C, or other module for it. ...
12
by: Ashu | last post by:
can anybody tell me the reason why following code is not working? int *funct() { int p=10; return &p; }
1
by: rocksoft | last post by:
Hi, i have devloping web application in Asp.net and c#, i have used ajax to achieve the auto complete text box, my company using visual studio 2003, ajax auto complete text box...
1
by: rocksoft | last post by:
Hi, I am working in asp.net with C# web application, i have used one textbox and image button for search funtion, i have created one user control for this, but after i have entered...
15
by: Konstantin Andreev | last post by:
I'm almost sure I've found bad bug, but for a while I can't neither confirm nor reject this. If anybody could make an independent test on it's own system, I'd appreciate it very much. The...
4
by: pk | last post by:
Hello. I'm new to YUI but I see it's a set of a very useful tools. So I'm trying to use it :) And I have first problem. Could anybody help me and explain why the slider which I created on my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.