Results 1 to 6 of 6
Hybrid View
-
4th November 2005 17:53 #1
,
:
<td width="400">Please tick if you have any of the following pets?</td>
<td>
<select name="Pets">
<option value="1">Dogs</option>
<option value="2">Cats</option>
<option value="3">Other please specify</option>
<option value="4">I don`t have any pets</option>
</select>
</td>
"3" ,:
<td width="400">Other - please specify</td>
<td><input type="text" name="Other_pet" size="30"></td>
, value="3", Other -textbox, => ?
-
4th November 2005 21:39 #2
( IE Moz), HTML . js -

-! ( id="insb" - <tr>- , ). <tr> appendChild. insertAfter - insertBefore.<html>
<script language="JavaScript1.3">
show_tr = 0;
function add_element()
{
elem2 = document.createElement("INPUT");
elem2.type = 'TEXT';
//elem2.size = 40;
//elem2.id = 'op1';
elem2.name = 'Other_pet';// input
td1 = document.createElement("TD");
td1.innerHTML = 'Other - please specify';
td2 = document.createElement("TD");
//td2.id = 'td_to_del';
td2.appendChild(elem2);
tr1 = document.createElement("TR");
tr1.id = 'tr_to_del';
tr1.appendChild(td1);
tr1.appendChild(td2);
insert_before = document.getElementById('insb');
table_body = document.getElementById('tb');
table_body.insertBefore(tr1,insert_befor e);
}
function remove_element()
{
tr1 = document.getElementById('tr_to_del');
table_body = document.getElementById('tb');
table_body.removeChild(tr1);
}
function check_select()
{
sel = document.getElementById('s1');
//if(sel[sel.selectedIndex].value==3&&!show_tr)
if(sel.selectedIndex==2&&!show_tr)
{
add_element();
show_tr = 1;
}
else if(show_tr)
{
show_tr = 0;
remove_element();
}
}
</script>
<table>
<tbody id="tb">
<tr><td>previous question 1</td><td></td></tr>
<tr>
<td width="400">Please tick if you have any of the following pets?</td>
<td>
<select name="Pets" onchange="check_select();" id="s1">
<option value="1">Dogs</option>
<option value="2">Cats</option>
<option value="3">Other please specify</option>
<option value="4">I don`t have any pets</option>
</select>
</td>
</tr>
<tr id="insb">
<td>next question 1</td>
<td></td>
</tr>
</tbody>
</table>
</html>
div innerHTML .
-
6th November 2005 15:08 #3
-
8th November 2005 03:52 #4
-
8th November 2005 16:57 #5...
Originally Posted by zimbabve

,(.. ) :
<td width="205" align="left" class="Body1bold">
<select name="ethnicity" onchange="doOther(this)">
<option value="0">Please select</option>
<option value="1">Asian/Pacific Islander</option>
<option value="2">Black/African American</option>
<option value="3">Hispanic/Latino American</option>
<option value="4">Native/Alaskan American</option>
<option value="5">White/Caucasian</option>
<option value="6">Other-please specify</option>
<option value="7">Prefer not to answer</option>
</select>
</td>
<tr valign="top" bgcolor="#FFE4CA">
<td align="left" nowrap="nowrap" class="Body1bold"><div id="id_eo1" style="display:none">Other</div></td>
<td align="left" nowrap="nowrap" class="Body1bold"><div id="id_eo2" style="display:none"><input type="text" name="ethnicity_other"/></div></td>
doOther(); -:
function doOther(s)
{
document.getElementById("id_eo1").style. display = s.selectedIndex == 6 ? "block" : "none";
document.getElementById("id_eo2").style. display = s.selectedIndex == 6 ? "block" : "none";
}Last edited by Skydive; 8th November 2005 at 17:04.
-
9th November 2005 00:36 #6




Reply With Quote

Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in