Randomize Web Images with JavaScript

This is documented in many other places on the Internet, but it can’t hurt to have too many tutorials. You can jazz up your web site with a bit of JavaScript to randomly insert images on your page. I’m doing this on my masthead, as one example. The first requirement is to build a list of images: Then write the code to select one at random: Finally, you need to set up the HTML to hold the image: The name=’myPic’ relates to the JS “document.myPic.src” declaration. The id=’frontphoto’ definition in the <img> tag is the CSS magic that sizes the image. And the ‘images/bg.gif’ is a placeholder image that gets… Read More

Continue Reading

Ruby 1.9.1 (Entry 1)

I installed Ruby 1.9.1 from the Ruby site. I did the default “configure ; make ; make test ; make install” dance as root using gcc 4.1.2. This puts all the Ruby 1.9.1 files under /usr/local. The Ruby 1.8.6 version is a standard RPM for Fedora Core 8, and it’s all under /usr. I decided to switch between the two Ruby versions by constructing shell aliases to change the $PATH variable, as shown below. The syntax is the bash shell. [cwl@Fedorahost ~]$ alias old_ruby alias old_ruby=’export PATH=/usr/kerberos/bin:/usr/lib/ccache: \ /usr/bin:/usr/local/bin:/bin:/usr/bin:/usr/games:/home/cwl/bin’ [cwl@Fedorahost ~]$ old_ruby [cwl@Fedorahost ~]$ ruby -v ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-linux] [cwl@Fedorahost ~]$ gem env RubyGems Environment: – RUBYGEMS… Read More

Continue Reading