View Full Version : Dynamic Selection Boxes with Answer not working.

06-18-2012, 11:41 PM
Hello, I am a newbie and I am wondering why this script does not work on my site (wordpress). Your assistance would be greatly appreciated, thanks! Kim

<title> Untitled </title>
<script type="text/javascript">
var choice = {
'a1':'29 HA', 'b1':'30 HA', 'c1':'31 HA',
'a2':'34 HA', 'b2':'36 HA', 'c2':'38 HA'

function showSelections() {
var dogSize = document.getElementById('dog').value;
var dogYear = document.getElementById('dyrs').value;
if ((dogSize == '_') || (dogYear == '_')) { alert('Missing choice'); return; }
var pick = dogSize+dogYear;

<select id="dog">
<option value="_">Dog</option>
<option value="a">Small Dog</option>
<option value="b">Medium Dog</option>
<option value="c">Large Dog</option>

<select id="dyrs">
<option value="_">Years</option>
<option value="1">3 years DA</option>
<option value="2">4 years DA</option>

<button onclick="showSelections()">Show Selections</button>

Old Pedant
06-18-2012, 11:47 PM
Works fine for me. If it doesn't work in your WordPress page, it's possible you have a JavaScript conflict with other stuff on the page.

Maybe give us the URL of your page?