0

No idea if this could be done by just javascript but don't know where else to post it...
I have a contact forum where i want the visitor to select if they're a member of not, if they select no, nothing happens but if they select yes a new text field pops up where they have to fill out their username.
thing is, i've researched a lot and just cannot find out how to do it...
Anybody know how to?

\\ Vic

4
Contributors
7
Replies
8
Views
7 Years
Discussion Span
Last Post by almostbob
0
<script type="text/javascript">
(document.getElementById) ? dom = true : dom = false;
function hideIt() {
if (dom) {document.getElementById("layerm1").style.visibility='hidden';}
if (document.layers) {document.layers["layerm1"].visibility='hide';} }
function showIt() {
if (dom) {document.getElementById("layerm1").style.visibility='visible';}
if (document.layers) {document.layers["layerm1"].visibility='show';} }
--></script>

<input type='radio' id='radiono'name='radioone' value='no' ><label for='radiono'>NO</label> 
<input type='radio' id='radioyes' value='yes' onClick="showIt();"><label for='radioyes'>YES</label>

<div id="layerm1" style="position:fixed; width:50%; visibility:hidden; padding:10px; margin:10px; background:#ececec; border: 1px solid;">
<center><font size="+1"><input><br><input>
<button onClick="hideIt();">Close</button></div>

Edited by almostbob: n/a

0

I'm fairly sure you can do it with only a few lines of php.

something like

if($member='yes'){
echo"<label>Please Enter your Username</label><br><input type='username' name='username'>";
}else{
echo"the rest of the form";
}
0

member of not, if they select no, nothing happens

Why not just have a username box which may be left blank?
Personally I find popups annoying, and clicking in one box solely for the purpose of causing another one to pop up would be doubly so.
Besides, users who have popups blocked (as I do) will never see it.

0

Why not just have a username box which may be left blank?
Personally I find popups annoying, and clicking in one box solely for the purpose of causing another one to pop up would be doubly so.
Besides, users who have popups blocked (as I do) will never see it.

the code sample is not a popup, so you will see it, its the same as the descriptive text used in this page
Flush

0

the code sample is not a popup

Sorry, my general comments to the original poster had nothing to do with your code sample.

0

deefensive little bugger aint I,
the op asked for a text field to popup not a page
dos vdanye

Edited by almostbob: n/a

0

I was remiss, what a mess, functional but UGLY

  • used <font> tag(for no real reason I can see)
  • didnt close <font>
  • didnt explain that the two versions of each function hideit showit were to ensure the script worked in most browsers >ie5 and >ff1 who have different DOM
  • didnt put any explanation at the hidden layer

headslap moment

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.