Using JavaScript to get radio values

A coworker was trying to figure out how to use JavaScript to get a RADIO value from a form. Because a radio form element makes up an array of possible selections, you have to cycle through that array to find the selected value. It is then that you can retrieve the actual selected value.

Check out the code below that I’m using to get the value of the selected radio element. From this you should be able to customize it for your needs. Simply insert your code or run your function in the level where I’m running the alert() command.

<script language="javascript">
function rockmyworld() {
 i=0;
 do {
  if (form.myRadio[i].checked == true) {
   alert(form.myRadio[i].value);
  }
  i++;
 } while (i < form.myRadio.length);
}
</script>
<form name=”form”>
<input type=”radio” name=”myRadio” value=”1″/> 1 <br/>
<input type=”radio” name=”myRadio” value=”2″/> 2 <br/>
<input type=”radio” name=”myRadio” value=”3″/> 3 <br/>
<input type=”button” value=”get value” onClick=”rockmyworld()”/>
</form>

Hope that helps any folk out there that were burnin’ brain cells trying to figure this out.

Digg This
March 31, 2006, 3:27 pm

Simply brilliant — Leo Burnett

This is probably one of the better portfolio’s I’ve seen in Flash >> http://www.leoburnett.ca/

Digg This
March 28, 2006, 5:58 pm

Another evening of improv

Spent a few hours this evening doing some improv and caught much of it on “tape.” I think eventually I need to start working on actual songs, but the improv forces me to try and be creative in real-time.

Anyway, you can hear the tunes over at michaelmiles.org. I may convert my entire music site over to WordPress and run it more like a blog that happens to have pages. I think it just might fit the bill more with what I’m doing.

I’ve also been considering the whole “perform live in your basement” thing, syndicating it with video feed to a server, where people purchase the ability to watch it. I think it’d be cool to even take it a step further, where they could switch camera angles on demand instead of going through and editing the angles down first, then upload the mixed video. It truly becomes more interactive, where the user can choose which angles they want to watch the performance at.

I’ve no clue how I’m going to do that (and if I ever will), but it’s something I’ve been considering anyway.

Digg This
March 27, 2006, 10:51 pm

When the future’s uncertain, make music

Well, with the onslaught of layoffs all across a certain HMO that I work for — to the tune of approximately 15% — one has to do what they can to try and take the uncertainty of am I next and replace it with something constructive.

In addition to wasting a half day playing BF2 on some pretty lame servers, I decided to sit down and record a few more improv tunes. I’ve got four in all, most of which I like. There’s a few spots here and there that show the imperfection of live, improv recording — but that’s to be expected.

Anyway, check ‘em out at michaelmiles.org.

One of these days I’ll get around to working on some “Tranquility”-esque sacreds and old hymns.

Digg This
March 26, 2006, 8:08 pm

IE bug with stylesheets and javascript?

So I’ve been working on one of our intranet sites and it looks just fine when I view it independently. Unfortunately though, we have everything in a frames environment…so when I view the site in the frames, the copy gets all tripped out, stacking upon itself when I scroll and/or navigate to other pages within that site.

I know it’s a stylesheet issue, for when I remove the stylesheet the problem goes away. But the thing I can’t figure out is why it’s doing it, when all the styles are W3C compliant and aren’t doing much other than setting padding values, font sizes, a few background elements. Pretty basic stuff.

Check it out for yourself: Before & After

I’m pretty much losing my mind trying to figure this out, since there’s another site that uses the SAME CODE (just located on a different server) and works just fine. Go figure.

Any thoughts anyone out there in the web development community?


UPDATE

For starters…this DOES work properly in Firefox. That wasn’t a suprise. But if you look at the example images, I’ve got a white then gray stripe down the left side. The image basically stops at the end of the gray stripe and I have it repeating vertically (Y axis) and have the following code in the body { } style:
background-image: url("../images/side_graystripe.gif");
background-repeat:repeat-y;

So I tried removing that snippet and everything worked fine. My solution? Take that background .gif image and extended it to 1600 px wide (the max width it’d be viewable at) and left the code in the stylesheet.

IE is apparently freezing the content when you scroll or nav to other pages with that same background code. Can we say “BUG?”

It’s an unusual scenario, I know, but at least I figured it out. Hope this helps anyone out there running into the same issue.

Digg This
March 23, 2006, 4:04 pm

Battlefield 2: European Expansion Pack

I’ve had a chance to play the new European expansion pack for Battlefield 2 and I have to say that I’m relatively disappointed. You really don’t get much…three maps, a few new weapons and some new vehicles.

The new chopper flies horribly — it’s way too sensitive for my joystick — but the new jet isn’t so bad. But on the whole, there really isn’t anything worth buying in the European expansion pack…even if it’s only ten bucks. Seriously. Save your money.

(more…)

Digg This
March 20, 2006, 12:37 am

Bill’s Ball Markers

I get a lot of traffic at my blog — which translates into good “Google value” — and I occassionally like to drop links to the underdog sites and give them a little boost in their Google presence.

I recently designed a micro-site for an 80+ year old man, who sells these monogrammed golfball markers — in fact, I think I actually met him at Thompson Municpal Golf Course a couple years back. My buddy Jake (at J.D. Laboratories) had me design a small thing for Bill’s Ball Markers and they really liked it.

Nothing fancy, but it looks like a great gift idea for the golfer friend or family member. So here’s to adding a little Google traffic to Bill’s Ball Markers… cheers!

Digg This
March 16, 2006, 11:21 am

A little snack for the road

I left work yesterday drained and more ready than ever to just go home and take a short nap — in a relatively bad mood. I was listening to KBEM Jazz 88 FM on my way home and something peculiar happened; something very out of the ordinary.

It’s not uncommon to get a little static now and then on the jazz station — they don’t have the strongest frequency — but this was unusual considering I was driving in Minneapolis, not that far from the station that I’d get static. What was unusual about this staticy sound, is that it had an unusual rhythmic quality to it that I just couldn’t place.

Well, the noise continued and became more and more clearly defined — crinkle crinkle crinkle… crunch crunch crunch…. crinkle crinkle crinkle…. crunch crunch crunch…

I thought to myself, “oh my gosh, did the DJ leave his microphone on???? ‘Cuz that sure sounds like someone eating chips into the microphone. All suspicions surrounding this bizarre occurrence were confirmed when I heard this cough…choke…cough sound as the guy choked on his chips!

I could hardly believe what I was hearing — so much so that I laughed nearly the whole way home over this episode. I called the studio line to have the DJ check his microphone, to which he basically said that Mike Marr (spelling?), the traffic guy, left his microphone on after the last traffic update. As embarrassing as it had to be for the two of them, it was a great pick-me-up for the drive home.

Thanks guys.

Digg This
March 15, 2006, 11:10 am

And what pray tell is this???

I knew we were going to get hit with some snow, but I sure didn’t think we’d get hit THIS hard.

I was about ready to leave the house at 7:30 this morning, only to sink my foot into about five inches of snow — and the only way that I was going to get out of the driveway was to plow. After thirty minutes of snow blowing the driveway I was ready and on my way. I knew that it would be slow-going out there, but I didn’t think it’d be as bad as it was.

Highway 280 was closed — probably due to an accident I’m sure — and I had been on I-94 for about 45 minutes and hadn’t even passed Lexington Parkway, which roughly translates into a three to five mile drive in that timeframe. So I called the boss and he suggested that I pull off somewhere and grab a cup of coffee, maybe see if I can’t get a little work done at a cafe or something.

(more…)

Digg This
March 13, 2006, 10:59 am

HP Pavilion DV1000 - the continuing saga

So my laptop’s overheating again. I’m running a free program called SpeedFan to monitor the temperature of the harddrive and the cpu. Unfortunately I can’t monitor fan speeds, but the most important thing is to get those temperature readings.

WITH AN ICE PACK UNDER MY LAPTOP: HD: 39° C; CPU: 54° C.

Not cool. Literally and figuratively.

The fan seems to sporadically kick in when it feels that the harddrive is getting too hot. But if the CPU’s being overloaded (and running at 57° C continually) and taxing my laptop’s resources by running an install app (or anything else for that matter), what’s going to ensure that those fans kick in more frequently?

I’ve googled around for what others have suggested; it seems I’m not the only one having the problems with the DV1000.

I tried getting on the chat with HP online support, but they kept closing the chat session on me. Bastards.

Looks like I may be backing up data tomorrow and heading over to Best Buy to get a different laptop sometime later this week.

Digg This
March 12, 2006, 2:23 am
« Previous Entries