Forums

This topic is locked

Radiobutton to reset Dropdown list

Posted 19 Dec 2002 22:43:13
1
has voted
19 Dec 2002 22:43:13 Robert Kruse posted:
I've been trying to get my radio button to reset the chosen option in a dropdown menu. My radio button calls the following function:

function CanShirt(form) {{
form.Colors.selectedIndex = form.Colors.options[-1];
}}

My radio button:
<input type="radio" name="radiobutton" value="T-Shirt" onclick="CanShirt(this.form)">

Am I on the right track, cause this doesn't work?

Thanks,
Bob

Replies

Replied 08 Jan 2003 12:08:19
08 Jan 2003 12:08:19 Dan The Man replied:
<b><font size=6>why the fuck do you have to post the same fuckin question twice ???</font id=size6></b>

Edited by - ANIMESHRINE1134 on 08 Jan 2003 12:11:56
Replied 08 Jan 2003 14:55:34
08 Jan 2003 14:55:34 Robert Kruse replied:
Maybe it was an accident, jerkoff. Are you that much of a loser that you have nothing better to do in life than to complain about stupid shit like this?
Replied 19 Jan 2003 12:25:05
19 Jan 2003 12:25:05 tim jamers replied:
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;/title&gt;
&lt;script language="javascript"&gt;
function choice(TheForm) {
TheForm.dropdownval.value = TheForm.colors[TheForm.colors.selectedIndex].text
}
function reset(TheForm) {
TheForm.colors.selectedIndex = TheForm.colors[0]
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form&gt;
&lt;p&gt;
&lt;select size="1" name="colors" onchange="choice(this.form)"&gt;
&lt;option&gt;Select color&lt;/option&gt;
&lt;option&gt;Black&lt;/option&gt;
&lt;option&gt;Blue&lt;/option&gt;
&lt;option&gt;Red&lt;/option&gt;
&lt;option&gt;White&lt;/option&gt;
&lt;/select&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;input type="radio" name="R1" value="reset" onClick="reset()"&gt;Click to reset your choice...&lt;br&gt;
- Your Selection: &lt;input type="text" name="dropdownval" size="40" value="Make your choice from the dropdown menu." onfocus="this.blur()"&gt;
&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;

That should do the trick <img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle> ...
enjoy!


Edited by - gangsta on 19 Jan 2003 12:27:32

Reply to this topic