PDA

View Full Version : combo size changes


rahulmca1
06-29-2007, 04:01 AM
A simple problem when I populate my combo using javascript my combo size changes (Problem is only on) Ie works ok in ff.

My code is


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>123</title>
<script type="text/javascript">
function test(){
var listFileClass = document.getElementById('listFileClass');
alert("listFileClass ="+listFileClass);
for (var loop = 0; loop < 6; loop=loop+1) {
var newDomainValueOption = document.createElement('option');
newDomainValueOption.setAttribute("value",loop);
newDomainValueOption.appendChild (document.createTextNode(loop));
listFileClass.appendChild(newDomainValueOption);
}

}
</script>
</head>
<body>
<table>
<tr>
<td width="100%">
<select style="width:100%" name="listFileClass" id="listFileClass">

</select>
</td>
<td>
<input type="button" value="test" onclick="test();">
</td>
</tr>
</table>
</body>
</html>

rahulmca1
07-02-2007, 12:54 AM
Plz guide me.


Why size of select is changing

Thanks
With regards

rahulmca1
07-26-2007, 04:34 AM
Plz plz plz plz plz Plz plz plz plz plz Plz plz plz plz plz Plz plz plz plz plz Plz plz plz plz plz Plz plz plz plz plzPlz plz plz plz plz Plz plz plz plz plz Plz plz plz plz plz

Please give me any alternative.


thanks

coothead
07-26-2007, 05:41 AM
Hi there rahulmca1,
when I populate my combo using javascript my combo size changes
Unless I am missing something, I can see no differences. :supereek:

As it stands, your present code will not validate so I suggest that you try it like this...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>123</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
window.onload=function() {
document.forms[0][1].onclick=function() {
test();
}
}
function test(){
listFileClass=document.getElementById('listFileClass');
alert("listFileClass ="+listFileClass);
for(loop=0;loop< 6;loop++) {
var newDomainValueOption=document.createElement('option');
newDomainValueOption.setAttribute("value",loop);
newDomainValueOption.appendChild (document.createTextNode(loop));
listFileClass.appendChild(newDomainValueOption);
}
}
</script>
<style type="text/css">
td, select {
width:100%;
}
</style>
</head>
<body>
<form action="#">
<table>
<tr>

<td>
<select name="listFileClass" id="listFileClass">
<option value="">options</option>
</select>
</td>

<td>
<input type="button" value="test">
</td>

</tr>
</table>
</form>

</body>
</html>
That part of the dtd highlighted in green is required to take IE out of Quirks Mode.
The items highlighted in purple are required to ensure validation.
If this does not effect a cure for you, please define your problem with a little more detail. :agree: