View Full Version : delete and copy buttons for a select box

06-12-2003, 09:42 PM
i have these two select boxes that filter the first item in a line into the first box and the second into the second box and i was wanting a delete and copy button that would delete or copy the selected item from a box... here is my code:


<script type="text/javascript" language="javascript">

function makeList(oIframe) {
var textarr, IFbody = oIframe.document.getElementsByTagName('body').item(0).innerText;
if (IFbody == '') return;
textarr = IFbody.replace(/<\/?xmp>/gi, '').replace(/ \- /g, ' ').split(/\s+/);
var newopt, oSelect1 = document.f.dynamic1, oSelect2 = document.f.dynamic2;
var txtlen, colons = '::::::::::::::::::::::::::::::';
oSelect1.length = oSelect2.length = 0;
oSelect1.options[0] = new Option;
oSelect2.options[0] = new Option;
for (var o=0; o<textarr.length; o+=2) {
txtlen = textarr[o].length;
newopt = new Option('' + textarr[o] + '',textarr[o]);
oSelect1.options[oSelect1.options.length] = newopt;
newopt.className = 'space';
txtlen = textarr[o+1].length;
newopt = new Option('' + textarr[o+1] + '',textarr[o]);
oSelect2.options[oSelect2.options.length] = newopt;
newopt.className = 'space';

function file_select(oFileUpload) {
var oForm = oFileUpload.form;
oForm.action = oFileUpload.value;
oForm.sub.style.visibility = 'visible';
oForm.start.style.visibility = 'hidden';



<form name="f" target="loader">

<input type="file" name="txtfile" style="position:absolute;top:-100px;" onchange="file_select(this)">
<input type="button" name="start" value="Browse..." onclick="txtfile.click()">
<input type="submit" name="sub" value="Load" style="visibility:hidden;">

<select name="dynamic1" id="dynamic1" style="width:100px;" multiple="false">


<select name="dynamic2" id="dynamic2" style="width:100px;" multiple="false">

<iframe name="loader" id="loader" width="0" height="0" src="about:blank" onload="makeList(loader)"></iframe>


and also for some reason i have to click "Load twice to get the list to load ....any help with this would be very much appreciated...thx a lot

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum