asp m javascript

Tags:    asp

Jeg har brug for lidt hjælp til at flette javascript ind i min asp, så jeg får en menu der henter over-og undermenupunkter fra min database.

Koden kommer her:

<!-- #include file="xxx.asp" -->
<!-- #include file="xxx2.asp" -->

<%
sql = "SELECT * FROM varegrupper WHERE Parent = '0'"
set record=rs.execute(sql)
Do until record.eof
id = record("varegruppeID")

sql2 = "SELECT * FROM varegrupper WHERE Parent = '" & id & "'"
set record2=rs.execute(sql2)
do until record2.eof
%>

<html>

<head>
<title>menu</title>
<base target="mainFrame">

<style type="text/css">
.menupunkt{font-family:arial;cursor:pointer;color:#FFFFFF;background:#C2DEC7;font-weight:800;font-size:13px;width:250px;font-style:italics;}
.menu{display:none;padding-left:15px;}
.menu a{text-decoration:none;}
.menu a:link{color:white;}
.menu a:visited{color:white;}
.menu a:hover{color:67A877;}
.menu a:active{color:67A877;}
</style>
<script language="javascript" type="text/javascript">
function showMenu(d){
var id = d.id.substring(5);
divs = document.getElementsByTagName('DIV');
for(i=0;divs.length>i;i++){
if(divs.id.indexOf('menu')==0&&divs.id!='menu'+id){
divs.style.display='none';
document.getElementById('o'+divs.id+'pic').src = "billeder/gif/plus.gif";
}
}
st = document.getElementById('menu'+id).style;
st.display = (st.display!='block')?'block':'none';
document.getElementById(d.id+'pic').src = (st.display=='block')?"billeder/gif/minus.gif":"billeder/gif/plus.gif";
}
</script>

</head>

<body bgcolor="#C2DEC7">
<div id="omenu1" class="menupunkt" onMouseover="showMenu(this);">
<img id="omenu1pic" src="billeder/gif/plus.gif" height="10" width="10">
<%
'Kalder overmenupunkt
response.write record("varegruppenavn")&" <br> "
record.MoveNext
%>
<div id="menu1" class="menu" onMouseover="event.cancelBubble=true">
<%
'Kalder undermenupunkt
response.write record2("varegruppenavn")&" <br> "
record2.MoveNext
%>
</div>
<%
Loop
%>
</div>
<%
Loop
%>
</body>

</html>

<!-- #include file="xxx.asp" -->

hvis du vil se hvordan menuen skal fungere så gå ind på www.millet-design.dk, der er den lavet med html og javascript




2 svar postet i denne tråd vises herunder
0 indlæg har modtaget i alt 0 karma
Sorter efter stemmer Sorter efter dato
Prøv det her...!

<!-- #include file="xxx.asp" -->
<!-- #include file="xxx2.asp" -->

<html>

<head>
<title>menu</title>
<base target="mainFrame">

<style type="text/css">
.menupunkt{font-family:arial;cursor:pointer;color:#FFFFFF;background:#C2DEC7;font-weight:800;font-size:13px;width:250px;font-style:italics;}
.menu{display:none;padding-left:15px;}
.menu a{text-decoration:none;}
.menu a:link{color:white;}
.menu a:visited{color:white;}
.menu a:hover{color:67A877;}
.menu a:active{color:67A877;}
</style>
<script language="javascript" type="text/javascript">
function showMenu(d){
var id = d.id.substring(5);
divs = document.getElementsByTagName('DIV');
for(i=0;divs.length>i;i++){
if(divs.id.indexOf('menu')==0&&divs.id!='menu'+id){
divs.style.display='none';
document.getElementById('o'+divs.id+'pic').src = "billeder/gif/plus.gif";
}
}
st = document.getElementById('menu'+id).style;
st.display = (st.display!='block')?'block':'none';
document.getElementById(d.id+'pic').src = (st.display=='block')?"billeder/gif/minus.gif":"billeder/gif/plus.gif";
}
</script>

</head>

<body bgcolor="#C2DEC7">
<%
sql = "SELECT * FROM varegrupper WHERE Parent = '0'"
set record=rs.execute(sql)
Do until record.eof
id = record("varegruppeID")

sql2 = "SELECT * FROM varegrupper WHERE Parent = '" & id & "'"
set record2=rs.execute(sql2)
do until record2.eof
%>
<div id="omenu1" class="menupunkt" onMouseover="showMenu(this);">
<img id="omenu1pic" src="billeder/gif/plus.gif" height="10" width="10">
<%
'Kalder overmenupunkt
response.write record("varegruppenavn")&" <br> "
record.MoveNext
%>
<div id="menu1" class="menu" onMouseover="event.cancelBubble=true">
<%
'Kalder undermenupunkt
response.write record2("varegruppenavn")&" <br> "
record2.MoveNext
%>
</div>
<%
Loop
%>
</div>
<%
Loop
%>
</body>

</html>

<!-- #include file="xxx.asp" -->

Paid Da Cost To Be Da Boss



Det var ikke løsningen, den ville ikke engang åbne en af menuerne.

Men ellers tak for forsøget.



t