You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Thanks to all respondents for their tips and hints!
Denis McMahon
unread,
Apr 2, 2013, 12:52:51 AM4/2/13
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
On Thu, 21 Mar 2013 20:42:52 -0400, meagain wrote:
> I've used javascript to generate a random number,
> but can you tell me how to choose a random "img"?
The following is one way to do so in javascript, as you said you've used
javascript, but I actually have no idea whether you want to use javascript
for this or not .....
You can load an array of n image locations into a document thus:
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rick0....@gmail.com.spamless
On Friday, March 22, 2013 1:42:52 AM UTC+1, meagain wrote:
> I've used javascript to generate a random number,
>
> but can you tell me how to choose a random "img"?
Which random number?
A random number between 1 and 20
or a random number between 0 and 1?
There are many possible ranges of numbers.
Jan Clemens Faerber
unread,
Apr 4, 2013, 1:02:41 PM4/4/13
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
On Tuesday, April 2, 2013 6:52:51 AM UTC+2, Denis McMahon wrote:
> On Thu, 21 Mar 2013 20:42:52 -0400, meagain wrote:
> > I've used javascript to generate a random number,
> > but can you tell me how to choose a random "img"?
>
> The following is one way to do so in javascript, as you said you've used
> javascript, but I actually have no idea whether you want to use javascript
> for this or not .....
your javascript example looks well -
but isn't it much more easy (in case
there is a relation:
"random number"~"number of pics")
to use document.writeln(... and here
you use the random number to write
the number of the gif (.jpg, whatever)?
Denis McMahon
unread,
Apr 5, 2013, 1:29:33 AM4/5/13
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Yes, you can do it that way, but working through the DOM seems to be
generally considered as better practice than document.write/ln, and
provides a method that can be used to, for example, change the random
image to another one when it is clicked on. I'm not sure that's so easy
to do with document.write/ln
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
On Friday, April 5, 2013 7:29:33 AM UTC+2, Denis McMahon wrote:
> Yes, you can do it that way, but working through the DOM seems to be
> generally considered as better practice than document.write/ln, and
> provides a method that can be used to, for example, change the random
> image to another one when it is clicked on. I'm not sure that's so easy
> to do with document.write/ln
>
> http://www.sined.co.uk/tmp/randomimg2.htm >
> Note that sometimes it will choose the current image as the new random
> image, so if it doesn't change when you click it, just click it again.
I understand.
Last time I even saw a way to switch the css style sheet with a few lines js using a cookie which is written again after a reload :)