473,320 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

beginner trying to make Radiobuttons & onClick work together

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[0]='testing'
menuchoice[1]='<a href="http://www.cnn.com">cnn</a>'
menuchoice[2]='testing some more'
i = 0;
var displaycode=menuchoice[i];
function changesearch(n)
{
var displaycode=menuchoice[n];
}
</script>
<p>
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>
</p>

<script language="JavaScript">
document.write(displaycode)
</script>
Sep 15 '06 #1
1 1446
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

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

Similar topics

1
by: discomiller | last post by:
Mario Mueller: Hello *, radiobuttons belong to other radiobuttons by the "name="any_value"" attribut. Thats a fakt. I got the following XML:...
4
by: TempMan | last post by:
I want this text field to always display a number variable. The variable "num" is defined in the head, how can I get a text box to display this varibale?? <input name="Balance" type="text"...
3
by: Martien van Wanrooij | last post by:
I am working on a site with some pages that all have a form that starts with a group of radiobuttons. By default none of the buttons is checked. Before submitting the form there is a validation...
2
by: Alex | last post by:
Hi all, I'm writing a small web application which searches a database based on a date field, and populates a datagrid control with the results. The datagrid control has selection buttons added...
6
by: Samantha | last post by:
Hi. hi have a custom created smooth progress bar (Pbar) control and i wanted to know how i can reset the bar to 0 after the bar has run to completion. The pbar uses a timer control to...
5
by: timothy.pollard | last post by:
Hi I'm having a bit of bother trying to make a questionnaire do what I want it to. I have put it up on www.web-iq.co.uk/test.htm. Basically the user of the final form (when I've tarted it up)...
10
by: See_Red_Run | last post by:
Hi, I am trying to figure out how to get started with PHP/MySQL. Everything I've read so far says to start with PHP first. I was expecting something like Visual Basic Express or some other type...
4
by: TechnoAtif | last post by:
Hi all. I have stuck up with a new problem.Hope anyone can find some solution for that. I have three radiobuttons and the situation is that on click of each radio button a new php page is to be...
22
by: ddg_linux | last post by:
I have been reading about and doing a lot of php code examples from books but now I find myself wanting to do something practical with some of the skills that I have learned. I am a beginner php...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.