Nedenstående kode virker på min lokale webserver, men ej hos mit webhotel.
Se fejl her
http://www.holmegaardskolen.dk/pernille/admin_selog1.asp
Har brugt en extension herfra
http://kermy7803.gearhost.net/
Håber I kan hjælpe.
Mvh.
Peter Rasmussen
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/Connbagterplogbog.asp" -->
<%
Dim rsparent
Dim rsparent_numRows
Set rsparent = Server.CreateObject("ADODB.Recordset")
rsparent.ActiveConnection = MM_Connbagterplogbog_STRING
rsparent.Source = "SELECT DISTINCT brugerid FROM logbog"
rsparent.CursorType = 0
rsparent.CursorLocation = 2
rsparent.LockType = 1
rsparent.Open()
rsparent_numRows = 0
%>
<%
Dim rschild
Dim rschild_numRows
Set rschild = Server.CreateObject("ADODB.Recordset")
rschild.ActiveConnection = MM_Connbagterplogbog_STRING
rschild.Source = "SELECT * FROM logbog"
rschild.CursorType = 0
rschild.CursorLocation = 2
rschild.LockType = 1
rschild.Open()
rschild_numRows = 0
%>
<html>
<head>
<title>Logbog</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stylesheets/style.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
<!--
var arrDynaList = new Array();
var arrDL1 = new Array();
arrDL1[1] = "parent"; // Name of parent list box
arrDL1[2] = "form1"; // Name of form containing parent
list box
arrDL1[3] = "child"; // Name of child list box
arrDL1[4] = "form1"; // Name of form containing child
list box
arrDL1[5] = arrDynaList;
<%
Dim txtDynaListRelation, txtDynaListLabel, txtDynaListValue, oDynaListRS
txtDynaListRelation = "brugerid" // Name of recordset field relating to
parent
txtDynaListLabel = "dato" // Name of recordset field for child
Item Label
txtDynaListValue = "dato" // Name of recordset field for child
Value
Set oDynaListRS = rschild // Name of child list box recordset
Dim varDynaList
varDynaList = -1
Dim varMaxWidth
varMaxWidth = "1"
Dim varCheckGroup
varCheckGroup = oDynaListRS.Fields.Item(txtDynaListRelation).Value
Dim varCheckLength
varCheckLength = 0
Dim varMaxLength
varMaxLength = 0
While (NOT oDynaListRS.EOF)
If (varCheckGroup <> oDynaListRS.Fields.Item(txtDynaListRelation).Value)
Then
If (varCheckLength > varMaxLength) Then
varMaxLength = varCheckLength
End If
varCheckLength = 0
End If
%>
arrDynaList[<%=(varDynaList+1)%>] =
"<%=(oDynaListRS.Fields.Item(txtDynaListRelation).Value)%>"
arrDynaList[<%=(varDynaList+2)%>] =
"<%=(oDynaListRS.Fields.Item(txtDynaListLabel).Value)%>"
arrDynaList[<%=(varDynaList+3)%>] =
"<%=(oDynaListRS.Fields.Item(txtDynaListValue).Value)%>"
<%
If (len(oDynaListRS.Fields.Item(txtDynaListLabel).Value) >
len(varMaxWidth)) Then
varMaxWidth = oDynaListRS.Fields.Item(txtDynaListLabel).Value
End If
varCheckLength = varCheckLength + 1
varDynaList = varDynaList + 3
oDynaListRS.MoveNext()
Wend
If (varCheckLength > varMaxLength) Then
varMaxLength = varCheckLength
End If
%>
//-->
</script>
<script language="JavaScript">
<!--
function setDynaList(arrDL){
var oList1 = document.forms[arrDL[2]].elements[arrDL[1]];
var oList2 = document.forms[arrDL[4]].elements[arrDL[3]];
var arrList = arrDL[5];
clearDynaList(oList2);
if (oList1.selectedIndex == -1){
oList1.selectedIndex = 0;
}
populateDynaList(oList2, oList1[oList1.selectedIndex].value, arrList);
return true;
}
function clearDynaList(oList){
for (var i = oList.options.length; i >= 0; i--){
oList.options[i] = null;
}
oList.selectedIndex = -1;
}
function populateDynaList(oList, nIndex, aArray){
for (var i = 0; i < aArray.length; i= i + 3){
if (aArray[i] == nIndex){
oList.options[oList.options.length] = new Option(aArray[i + 1], aArray[i
+ 2]);
}
}
if (oList.options.length == 0){
oList.options[oList.options.length] = new Option("[none available]",0);
}
oList.selectedIndex = 0;
}
function Kermy_JS(jsStr) {
return eval(jsStr)
}
//-->
</script>
</head>
<body onload="Kermy_JS('setDynaList(arrDL1)')">
<div class="center">
<table width="100%" cellpadding="0" cellspacing="0" class="indholdstabel">
<tr>
<td colspan="2" class="tabeloverskrift"> </td>
</tr>
<tr class="midtsektion">
<td height="28" valign="top" class="content">
<!-- #include virtual file="menu.asp" -->
</td>
</tr>
<tr class="midtsektion">
<td valign="top" class="content"><br> <table width="70%" border="0">
<tr>
<td><form name="form1" method="post" action="">
<p>
<select onchange="Kermy_JS('setDynaList(arrDL1)')"
name="parent" id="parent">
<%
While (NOT rsparent.EOF)
%>
<option
value="<%=(rsparent.Fields.Item("brugerid").Value)%>" <%If (Not
isNull((rsparent_first))) Then If
(CStr(rsparent.Fields.Item("brugerid").Value) = CStr((rsparent_first))) Then
Response.Write("SELECTED") : Response.Write("")%>
><%=(rsparent.Fields.Item("brugerid").Value)%></option>
<%
rsparent.MoveNext()
Wend
If (rsparent.CursorType > 0) Then
rsparent.MoveFirst
Else
rsparent.Requery
End If
%>
</select>
<select name="child" id="child">
<%
While (NOT rschild.EOF)
%>
<option
value="<%=(rschild.Fields.Item("dato").Value)%>"><%=(rschild.Fields.Item("da
to").Value)%></option>
<%
rschild.MoveNext()
Wend
If (rschild.CursorType > 0) Then
rschild.MoveFirst
Else
rschild.Requery
End If
%>
</select>
<input type="submit" name="Submit" value="Tilføj
kommentar !">
</p>
<p>Med tiden skulle her gerne komme en tekst udfra
ovenstående
kriterier....</p>
<table width="350" border="0">
<tr>
<td>Her er tabel til teksten</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<p> </p>
<p> </p>
</form></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" class="bund" > </td>
</tr>
</table>
</div>
</body>
</html>
<%
rsparent.Close()
Set rsparent = Nothing
%>
<%
rschild.Close()
Set rschild = Nothing
%>