How can I make a table row appear after the page loads based on an event handler?
This is what I’ve got so far:
[code=php]
<table border=4 width=”500″ align=”center” cellspacing=”2″ cellpadding=”0″>
<tr>
<td width=”50%”>Did you like the photos of this home?</td>
<td width=”50%”><select name=”photos” onChange=”changeForm(this.value);”>
<option value=””>Select One</option>
<option value=”yes”>Yes</option>
<option value=”no”>No</option>
</select></td>
</tr>
<script>
var _w2 = ”;
_w2 = ‘<tr><td id=one name=one>’+_w2+'</td><td id=two name=two valign=”top”>’+_w2+'</td></tr>’;
document.write(_w2);
function changeForm(_v) {
if(_v==’no’){
one1 = ‘Would you like to visit more homes showcased by MyOpenHouse.com?’;
two2 ='<select name=”visit”><option value=””>Select One</option><option value=”yes”>Yes</option><option value=”no”>No</option></select>’;
}else if(_v==’yes’){
one1 = ‘Would you like to know more about this home?’;
two2 ='<select name=”know”><option value=””>Select One</option><option value=”yes”>Yes</option><option value=”no”>No</option></select>’;
}else if(_v==”){
one1 = ”;
two2 =”;
}
eval(‘document.all.one.innerHTML=one1;’);
eval(‘document.all.two.innerHTML=two2;’);
}
</script>
</table>
This code works, but the problem I have with it is that it produces a table with a rather unsightly thick lower border until an option is chosen.
When I try to include the document.write inside the function, when an option is chosen, the page cuts to a blank page.
Any suggestions? Or should i try to use a different method?