By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,605 Members | 2,153 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,605 IT Pros & Developers. It's quick & easy.

beginner trying to make Radiobuttons & onClick work together

P: 6
I'm looking to create a search box that creates different kinds of searches based on a radio button selection. The first stage of this process for me is setting it up so clicking on different radio buttons changes what the document.write() function displays (later I intend to replace the small bits of text/html I have document.write displaying to the code required for my searches). I have the radio buttons and the document.write() working fine but I'm not sure how to incorporate the onClick event. Here's my code so far, any suggestions would be welcome:

<script language="JavaScript">
function StringArray (n)
this.length = n;
for (var i =1; i<=n; i++)
this[i] = ' '
menuchoice = new StringArray(3)
menuchoice[1]='<a href="">cnn</a>'
menuchoice[2]='testing some more'
i = 0;
var displaycode=menuchoice[i];
function changesearch(n)
var displaycode=menuchoice[n];
Search Library:<br />
<a onClick="changesearch(0);"><input type=radio name="seachchoice" value=0>Catalog</a>
<a onClick="changesearch(1);"><input type=radio name="seachchoice" value=1>Webpage</a>

<script language="JavaScript">
Sep 15 '06 #1
Share this Question
Share on Google+
1 Reply

P: 6
Sorry about repeating myself, I was looking at an earlier post and had a question for someone who replied to it, ended up asking the same question that I did in this post.
Sep 15 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.