/    Sign up×
Community /Pin to ProfileBookmark

Radio AJAX check

My aim is that when one of the radio button is clicked, a text field appears under it.

here is my table:

[code=html] <table width=”381″ border=”0″>
<tr>
<td width=”125″><label>
<input type=”radio” name=”radio” id=”Your Name” value=”Your Name”>
Your Name</label></td>
<td width=”144″><label>
<input type=”radio” name=”radio” id=”Personal Text” value=”Personal Text” onclick=”showinput(this.value);”>
Personal Text</label>
<label> </label></td>
<td width=”98″><label>
<input type=”radio” name=”radio” id=”None” value=”None”>
None</label></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><div align=”center” id=’debug’></div></td>
<td>&nbsp;</td>
</tr>
</table>[/code]

And iI created this simple function called [FONT=”Courier New”]showinput[/FONT]. But it doesn’t seems to work.
Why is that?

Here is my function:

[code=html]function showinput(el){
{
put(‘<input type=”text” name=”Personal Textbox” id=”Personal Textbox”>’);
}
}[/code]

the put is a function that shows in a div. (in this case, debug).

[code=html]function put(text){
obj = document.getElementById(‘debug’);
obj.innerHTML = text;
}[/code]

What is wrong with the showinput function?

… I know this is pretty easy for some, but it ain’t for me ?
Thanks

Cheers,
rwt

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@Angry_Black_ManJul 07.2007 — werked for me under IE6
Copy linkTweet thisAlerts:
@rwtauthorJul 07.2007 — Haaaa, now I know what I did wrong.

The file is included in the index and the index loads the javascript. But I forgot to run the index.

Also, is there a way to hide the textbox if I change my mind and choos another option?

thanks
Copy linkTweet thisAlerts:
@Angry_Black_ManJul 07.2007 — yeppers. do a obj.style.visibility/display property change on the object. i forget which exactly tho
Copy linkTweet thisAlerts:
@rwtauthorJul 07.2007 — actually I just created another function that replaces the div with a space.
×

Success!

Help @rwt spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...