HTML Javascript Clone [copy] Selectbox

<script language=”javascript” type=”text/javascript”>
function copyselectbox(sourceobj, destobj) {
var sourceobj_options = sourceobj.options;
for(var i=0;i<sourceobj_options.length;i++) {
destobj.options[i] = new Option(sourceobj[i].text);
destobj.options[i].value = sourceobj[i].value;
function populateSelectbox(obj,value) {
for(i = 0; i<obj.length; i++)
if (obj[i].value.toLowerCase() == value.toLowerCase())
obj[i].selected = true;
function test() {
var selobj = document.getElementById(“sel_test”);
var destobj = document.getElementById(“sel_test1”);
copyselectbox(selobj, destobj);
var selvalue = selobj.options[selobj.selectedIndex].value;
populateSelectbox(destobj, selvalue);

<form name=”frmtest” id=”” action=”” method=”post”>
<select name=”sel_test” id=”sel_test”>
<option value=”1″>One</option>
<option value=”2″>Two</option>
<option value=”3″>Three</option>
<select name=”sel_test1″ id=”sel_test1″></select>
<input type=”button” name=”cmd_button” value=”Test” onclick=”javascript:test();”>


About selvam4win

I am Selvam. I am very jolly person and frank one.

Posted on September 6, 2010, in clone dropdown, clone selectbox, copy dropdown, copy selectbox, HTML, javascript. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: