...

View Full Version : about dynamic drop list



bsharif
06-06-2006, 09:55 PM
help needed!! I need code that creates a drop list , once a user selected a choice like name from the drop list. An onchange event occurs that brings up 3 textfields that allow the user to enter/type in firstname middlename and lastname.

thanks :thumbsup:

bsharif
06-07-2006, 08:31 PM
Any help out there with this question?

vwphillips
06-08-2006, 12:42 AM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<style type="text/css">
/*<![CDATA[*/
.FrmDiv {
position:absolute;visibility:hidden;width:200px;
}

/*]]>*/
</style>

<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/

var SelAry=[];
SelAry[0]=['Select IP',''];
SelAry[1]=['Name IP','nameip'];
SelAry[2]=['Phone IP','phoneip'];

function Populate(id,ary,fun){
var sel=document.getElementById(id)
for (var zxc0=0;zxc0<ary.length;zxc0++){
sel.options[zxc0]=new Option(ary[zxc0][0],ary[zxc0][1],true,true);
}
sel.selectedIndex=0;
sel.onchange=function(){ window[fun](this); }
}

function CngIP(obj){
var ipobj;
if (obj.ipobj){
obj.ipobj.style.visibility='hidden';
}
if (obj.value){
ipobj=obj.form[obj.value].parentNode;
ipobj.style.visibility='visible';
ipobj.style.left=(zxcPos(obj)[0]+100)+'px';
ipobj.style.top=(zxcPos(obj)[1])+'px';
}
obj.ipobj=ipobj;
}

function zxcPos(zxcobj){
zxclft=zxcobj.offsetLeft;
zxctop=zxcobj.offsetTop;
while(zxcobj.offsetParent!=null){
zxcpar=zxcobj.offsetParent;
zxclft+=zxcpar.offsetLeft;
zxctop+=zxcpar.offsetTop;
zxcobj=zxcpar;
}
return [zxclft,zxctop];
}


/*]]>*/
</script>

</head>

<body onload="Populate('IPSel',SelAry,'CngIP')">
<br /><br />

<center><form>
<select id="IPSel" name=IPSel" ></select>
<div class="FrmDiv">
Name <input type=text name="nameip" />
</div>
<div class="FrmDiv">
Phone <input type=text name="phoneip" />
</div>
</form>
</center></body>

</html>

bsharif
06-08-2006, 07:06 PM
thank you very much , life saver...:thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum