arcmax
05-24-2005, 06:54 AM
Hi guys,
This is a the current code which generates unlimited text boxes.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<script language="JavaScript" type="text/javascript">
var noRows=0;
function addTextBox(select){
var ids = ['roomtype','datestart','dateend','rate'];
var container = document.getElementById('TextBoxes');
var nu = select.options[select.selectedIndex].value;
for(;nu--;noRows++){
for(var k=0,id; id=ids[k]; k++)
container.appendChild(createTextBox(id+noRows));
container.appendChild(document.createElement('br'));
}
}
function createTextBox(id)
{
var box = document.createElement('input');
box.type = 'text';
box.size = '15';
box.id = box.name = id;
return box;
}
</script></head>
<body>
<form name="form" action="index2.php" method="post">
<select name="AddTextBox" size="1" onchange="addTextBox(this);" >
<option value="0">Add row</option>
<option value="1">One Row</option>
<option value="2">Two Row</option>
<option value="3">Three Row</option>
<option value="4">Four Row</option>
</select>
<div id="TextBoxes" ></div>
<input type="submit">
</body>
</html>
What I would like to do is along with the text boxes I would like to generate a a drop down box with the values (single,double,triple, quadruple).
How can it be done?
Thanks
Apurva M
This is a the current code which generates unlimited text boxes.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<script language="JavaScript" type="text/javascript">
var noRows=0;
function addTextBox(select){
var ids = ['roomtype','datestart','dateend','rate'];
var container = document.getElementById('TextBoxes');
var nu = select.options[select.selectedIndex].value;
for(;nu--;noRows++){
for(var k=0,id; id=ids[k]; k++)
container.appendChild(createTextBox(id+noRows));
container.appendChild(document.createElement('br'));
}
}
function createTextBox(id)
{
var box = document.createElement('input');
box.type = 'text';
box.size = '15';
box.id = box.name = id;
return box;
}
</script></head>
<body>
<form name="form" action="index2.php" method="post">
<select name="AddTextBox" size="1" onchange="addTextBox(this);" >
<option value="0">Add row</option>
<option value="1">One Row</option>
<option value="2">Two Row</option>
<option value="3">Three Row</option>
<option value="4">Four Row</option>
</select>
<div id="TextBoxes" ></div>
<input type="submit">
</body>
</html>
What I would like to do is along with the text boxes I would like to generate a a drop down box with the values (single,double,triple, quadruple).
How can it be done?
Thanks
Apurva M