Coding questions

Not necessarily, can use both too. I think using both will make sure IE5.5 Mac works a treat too. I've just always used float:left; but I think they're a means to the same end.
 
Anyone know why this wont work?

Just learning Javascript and thought I would make some formula to work out which numbers are prime for those under 100.

The script is fine and works seperately, so you can ignore that to an extent, but when added into a function called myfunction it won't work.

Using an input button (not sure if thats the way it should be done but it'll do).

Here's the header code:

<script type="text/javascript">
function myfunction()
{
var a, b, c, d;
for (num=1; num<=100; num++)
{
// Creating variables that hold the remainder when num is divided by these 5 numbers
a=num%2; b=num%3; c=num%5; d=num%7;
// If the number is 2, 3, 5 or 7 write it now
if (num==2 || num==3 || num==5 || num==7)
{
document.write(num + ", ");
}
// If the remainders of all aren't 0 or if the number isn't 1 then write it out as a prime
else if (a!=0 && b!=0 && c!=0 && d!=0 && num!=1)
{
document.write(num + ", ");
}
}
}
</script>

and the body:

<input type="button" value="Yeah!" onclick="myfunction()" />
 
Preloading images

When you preload images using JavaScript, does the user see that their browser is loading something, even though everything they should see is already visible? If so, is there any way to make them preload in the "background" ?

I'd like to know now because I will be messing around with them for an upcoming project.
EDIT: Oh, and using sprites is out of the question right now...
 
Not sure Gary. I'd be pretty confident that they're loaded with the user having no indication of such though?
 
Back
Top