how to display   as white spaces in javascript

admin

Administrator
Staff member
HI,

I have html page which contains two arrarys which basically
contains parent child relationship.

Finally from the array, I need to display like this
FATHER
SON
DAUGHTER.

and I CANNOT DO document.write since the position of the select box is not known and also it should work in netscape
and IE.

thanks in advance

hERE IS THE SAMPLE CODE.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">

</head>
<body>
<form id="f1" name="f1">
<select name="S1" id="S1" alt="Select a library context" >

</select>
</form>
<script>
var aBaseLib= new Array("FATHER,FATHER")

var aSubLib=new Array("FATHER","&nbsp;SON,SON","&nbsp;DAUGHTER,DAUGHTER")

var sLoadBaseLib =document.f1.S1;
for(var iBaseLib = 0;iBaseLib < aBaseLib.length; iBaseLib++)
{
var sBaseName = aBaseLib[iBaseLib].split(",");

sLoadBaseLib[sLoadBaseLib.length] = new Option(sBaseName[0],sBaseName[1]);

if(aSubLib != "" && sBaseName[0] == aSubLib[0])
{
for(var iSubLib = 1;iSubLib < aSubLib.length; iSubLib++)
{
var sSubName = aSubLib[iSubLib].split(",");


sLoadBaseLib[sLoadBaseLib.length] = new Option(sSubName[0],sSubName[1]);

}
}
}

</script>
</body>
</html>
 
Back
Top