simple flip image javascript

sometimes you want an image to change when you select a different option in a dropdown, i used to do it the hard way:

function flip() {
document.images.x.src="themes/x/"+ document.reg.thememem.options[document.reg.thememem.selectedIndex].value+".gif";
}

i had to write a new js function for every new dropdown i use. so i looked for an easier way and wrote something:

function flip(image_id, select_name) { 
document.getElementById(image_id).src = select_name.options[select_name.selectedIndex].value 
}

to use it, do something like:

<select name="myselect" onchange="flip('myImage', this)"> 
<option value="images/candle.gif">candle</option> 
<option value="images/coin.gif">coin</option> 
<option value="images/earth.gif">earth</option> 
</select> <img id="myImage" src="images/balloons.gif">

obviously if you want to call it a second time, just pass a different image_id to it and make sure it matches the id attribute of your second img tag :)

the mystery of querying

if i know (or remember) more from my database class, i may have an answer for this. i was just coding my new board and was curious about which of the following query is faster:

SELECT m.regdate, m2.postnum FROM dmb_members m, dmb_members_post m2 WHERE m.uid=m2.uid AND m.uid = '".$userid."' LIMIT 1

or

SELECT m.regdate, m2.postnum FROM dmb_members m, dmb_members_post m2 WHERE m2.uid = '".$userid."' AND m.uid = '".$userid."' LIMIT 1

m.uid is a primary index while m2.uid is an index. what would be your guess?
Continue reading

muddy puppies

sunday was such a beautiful day. if you live in iowa city, you jump at every nice weekend coz it doesn’t happen often. we took the dogs for a walk at a trail. much to my surprise, most of the trail is extremely muddy with the smelting snow. we turned out to be a muddy family when we returned. sunday was also misty’s FIRST day walking with a leash. she did really good although at first she refused to walk. (click on the thumbnails to view larger versions)
nope, i won't walk
misty refusing to walk. it’s just like you put a leash on a cat. you have to drag her.

brother is walking fine
brother is walking fine. see?

fine i will walk a little bit
misty: fine i will walk a little bit

aww i got so muddy!
i got so muddy

time to wipe it all on daddy
time to wipe muddy paws all over daddy

what a tiring day
bubo: what a tiring day (bubo in andy’s arms while he’s driving)