Show/hide div based on radio button select

hey i’m new to using Javascript and am really struggling!!!

i would like to have 2 radio buttons each with a associated div

when the page loads the first radio button will be checked and its corresponding div will be show

when the user checks the other radio button its corresponding div is shown and the first div is hidden

could anyone help with this?? or point me in the right direction


worked it out. here’s my solution if anyone’s interested:

function show_hide(show, hide)

<form method=“post” action=“aaa.php”>
<input type=“radio” name=“search” value=“standard” onClick=“show_hide(‘standard’, ‘advanced’)” checked />Standard Search
<div id=“standard” style=“display: block;”>
Standard search div
<br />
<input type=“radio” name=“search” value=“advanced” onClick=“show_hide(‘advanced’, ‘standard’)” />Advanced search
<div id=“advanced” style=“display: none;”>
Advanced search div
<br />
<input type=“submit” value=“Submit” />

good idea, but one question on that.
How do i make a 3rd Div and a third checkbox. ?

I added
function show_hide(show, hide, hide)

and a third

and a new

onClick=“show_hide(‘advanced’, ‘standard’, ‘newone’)”

on the radio butttons but that dont work !

Any advise ?

best regards