I vedhæftede kode forsøger jeg at lave 2 kolonner, hvor den ene
kollone på forhånd er udfyldt med "*" og det skal herefter være
muligt at indsætte et "*" ved blot at klikke på den midterste
kollone, men det virker ikke.
Er der nogen der kan hjælpe?
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>Ny side 1</title>
<script type="text/JavaScript1.2">
<!--
function addItemList(idNumber, itemString)
{
document.forms[0].elements['selectedItem[]'].options[document.for
ms[0].elements['selectedItem[]'].length-1].text = itemString;
document.forms[0].elements['selectedItem[]'].options[document.for
ms[0].elements['selectedItem[]'].length-1].value = idNumber;
document.forms[0].elements['selectedItem[]'].length =
document.forms[0].elements['selectedItem[]'].length+1;
document.forms[0].elements['agent[]'].options[document.forms[0].e
lements['agent[]'].length-1].text = "*";
document.forms[0].elements['agent[]'].options[document.forms[0].e
lements['agent[]'].length-1].value = idNumber;
document.forms[0].elements['agent[]'].length =
document.forms[0].elements['agent[]'].length+1;
document.forms[0].elements['producer[]'].options[document.forms[0
].elements['producer[]'].length-1].text = "";
document.forms[0].elements['producer[]'].options[document.forms[0
].elements['producer[]'].length-1].value = idNumber;
document.forms[0].elements['producer[]'].length =
document.forms[0].elements['producer[]'].length+1;
}
function deleteItem()
{
i =
document.forms[0].elements['selectedItem[]'].options.selectedInde
x;
document.forms[0].elements['selectedItem[]'].options[i] = null;
}
function forward()
{
for(i = 0, l =
document.forms[0].elements['selectedItem[]'].length; i<l; i++)
{
document.forms[0].elements['selectedItem[]'].options[i].selecte
d = true;
}
document.items.submit();
}
producerSelected()
{
i =
document.forms[0].elements['producer[]'].options.selectedIndex;
document.forms[0].elements['producer[]'].options[i].text = "*";
document.forms[0].elements['agent[]'].options[i].text = "";
}
//-->
</script>
</head>
<body>
<form action="evaluatecompinfoItem.php" method="POST"
name="items">
<select name="selectedItem[]" multiple="yes" size=8>
<option>
</option>
</select>
<select name="producer[]" multiple="yes" size=8
onClick="producerSelected()">
<option>
</option>
</select>
<select name="agent[]" multiple="yes" size=8>
<option>*
</option>
</select>
<br>
<input type=button value='Fjern >' onClick="deleteItem()">
<p>
<input type=submit value="Submit and go to step 3"
onClick="forward()">
</form>
<script language="JavaScript1.2">
addItemList('234', 'Winch');
addItemList('45', 'CPP');
addItemList('290', 'FPP');
addItemList('340', 'Waterjet');
</script>
</body>
</html>
--
Vil du lære at kode HTML, XHTML, CSS, SSI, ASP eller ASP.NET?
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! =>
http://www.html.dk/tutorials