3D chat - ASP/Javascript !
Hejsa !Jeg er temmelig god til ASP, men ikke særlig god til javascript !
Så for ikke så lang tid siden, satte jeg et spørgsmål op om hvordan jeg kunne få min chat til ikke at blinke ! Personen der svarede skrev noget indviklet noget !
Jeg har forsøgt at gøre det, og jeg ved det ikke er rigtigt og jeg vidste det ikke ville blive rigtigt da jeg begyndte
Men jeg tænkte i kunne hjælpe mig !
Den lange kode:
<%
'//Kontakt til Chat-Database
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("../../../database/db.mdb") & ";UID=admin;PWD=;"
Set rs = Server.CreateObject("ADODB.RecordSet")
strSQL = "Select * From chat where brugernavn = '" & Session("brugernavn") & "'"
rs.Open strSQL, Conn, 1, 3
if rs.EOF then
Response.Redirect("fejl.asp?error=Du er blevet smidt af. Prøv at tryk på genstart")
end if
'//ned tælling!
if rs("hidden") <> "0" then
rs("hidden") = rs("hidden") - 1
rs.Update
end if
rs.Close
Set rs = Nothing
Conn.Close
set Conn = Nothing
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.MapPath("../../../database/db.mdb")
id = Request.QueryString("id")
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT * FROM room WHERE Id=" & id, Conn, 1, 3
Session("rum") = rs("Id")
%>
document.write("<DIV id=roomBG style="z-index: 100; background-repeat: repeat; background-attachment: scroll; left: -3; width: 383; position: absolute; top: 0; height: 354; background-position: 0% 50%" align=center name="roomBG">");
document.write("<img border="1" src="<%= rs("BG") %>" align="left"></DIV>");
document.write("<DIV id=roomBG style="z-index: 100; background-repeat: repeat; background-attachment: scroll; left: 3; width: 383; position: absolute; top: 0; height: 354; background-position: 0% 50%" align=left name="roomBG">");
document.write("<SPAN style="FILTER: dropshadow(color:black,offy:1,offx:1); WIDTH: 100%; COLOR: white"><font face="Arial" size="1"><%= rs("titel") %> # <%= rs("id") %></font></SPAN></DIV>");
<%
'//Database forbindelse
Set connect = Server.CreateObject("ADODB.Connection")
Connect.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../../../database/db.mdb")
sql = "select * From ting where sted = '" & Session("roomID") & "' ORDER BY id desc"
Set rs = Server.CreateObject("ADODB.Recordset")
set rs = Connect.execute(SQL)
count = 99
While not rs.eof and count > 0
count = count -1
%>
document.write("<DIV id=ting style="z-index: 100; background-repeat: repeat; background-attachment: scroll; left: <%= rs("left") %>; width: 48; position: absolute; top: <%= rs("top") %>; height: 94; background-position: 0% 50%" align=center name="ting">");
document.write("<img border="0" src="gfx/ting/<%= rs("grafik") %><%= rs("model") %>.gif"></DIV>");
<%
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
Connect.Close
set Connect = Nothing
%>
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.MapPath("../../../database/db.mdb")
id = Request.QueryString("id")
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT * FROM room WHERE ID=" & id, Conn, 1, 3
Session("roomID") = rs("ID")
%>
document.write("<DIV id=roomBG style="z-index: 100; background-repeat: repeat; background-attachment: scroll; left: -3; width: 383; position: absolute; top: 0; height: 354; background-position: 0% 50%" align=center name="roomBG">");
document.write("<map name="FPMap0">");
<% if session("status") = "Admin" then %>
document.write("<!--#include file="felter.asp" -->");
<% else %>
<%= rs("code") %>
<% end if %>
document.write("</map><img border="1" src="http://www.chive.dk/mandtest/chat/gfx/none.gif" usemap="#FPMap0" align="left" width="379" height="352"></DIV>");
<%
'//Database forbindelse
Set connect = Server.CreateObject("ADODB.Connection")
Connect.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../../../database/db.mdb")
sql = "select * From chat where roomid = " & Request.QueryString("id")
Set rs = Server.CreateObject("ADODB.Recordset")
set rs = Connect.execute(SQL)
count = 50
While not rs.eof and count > 0
count = count -1
session("kon") = rs("kon")
%>
document.write("<DIV id=humor style="z-index: 100; background-repeat: repeat; background-attachment: scroll; left: <%= rs("left") %>; width: 48; position: absolute; top: <%= rs("top") %>; height: 94; background-position: 0% 50%" align=center name="bruger">");
document.write("<img border="0" src="gfx/face3.gif"></DIV>");
document.write("<DIV id=humor style="z-index: 100; background-repeat: repeat; background-attachment: scroll; left: <%= rs("left") %>; width: 48; position: absolute; top: <%= rs("top") %>; height: 94; background-position: 0% 50%" align=center name="bruger">");
document.write("<br><br><br><br><br><font color="#FFFFFF" size="1" face="Arial"><SPAN style="FILTER: dropshadow(color:black,offy:1,offx:1); WIDTH: 100%; COLOR: white"><%= rs("brugernavn") %></SPAN></font></DIV>");
<%
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
Connect.Close
set Connect = Nothing
%>
<%
'//Database forbindelse
Set connect = Server.CreateObject("ADODB.Connection")
Connect.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../../../database/db.mdb")
sql = "select * From chat where roomid = " & Request.QueryString("id")
Set rs = Server.CreateObject("ADODB.Recordset")
set rs = Connect.execute(SQL)
count = 50
While not rs.eof and count > 0
count = count -1
%>
<%
if rs("besked") <> "" then
if rs("hidden") <> "0" then
%>
document.write("<DIV id=Tale style="z-index: 100; background-repeat: repeat; background-attachment: scroll; left: <%= rs("left") %>; position: absolute; top: <%= rs("top") %>; height: 128; width: 126; background-position: 0% 50%" align=center name="Tale">");
document.write("<table border="0" width="86%">");
document.write("<tr>");
document.write("<td width="336%"><font color="#000000"> </font></td>");
document.write("<td width="78%"><table border="0" width="8%" onmousedown=this.filters.alpha.opacity=65 onmouseover=this.filters.alpha.opacity=65 style="FILTER: alpha(opacity=65)" onmouseout=this.filters.alpha.opacity=65>");
document.write("<tr>");
document.write("<td width="100%">");
document.write("<table cellSpacing="0" cellPadding="0" align="center" border="0" width="100%" height="1">");
document.write("<tr>");
document.write("</tr>");
document.write("</table>");
document.write("<table width="100%" border="0" cellspacing="0" cellpadding="3" height="1">");
document.write("<tr>");
document.write("<td background="gfx/bobbel_top.gif">");
document.write("<table width="100%" border="0" cellspacing="0" cellpadding="3" height="1">");
document.write("<tr>");
document.write("<td>");
document.write("</tr>");
document.write("</table>");
document.write("</tr>");
document.write("</table>");
document.write("<table border="0" cellspacing="0" cellpadding="0" width="100" align="center" height="19">");
document.write("<tr>");
document.write("<td width="1" valign="top" bgcolor="#000000"><font size="1" face="Tw Cen MT Condensed" color="#000000"><img src="images/intet.gif" width="1"></font></td>");
document.write("<td width="100%" valign="top" bgcolor="#808080" background="gfx/bobbel_BG.gif">");
document.write("<table width="100%" border="0" cellspacing="4" cellpadding="0">");
document.write("<tr>");
document.write("<td width="100%"><font face="Arial" size="1" color="#000000"><%= rs("besked") %></font></td>");
document.write("</tr>");
document.write("</table>");
document.write("</td>");
document.write("<td width="1" valign="top" bgcolor="#000000"><font size="1" face="Tw Cen MT Condensed" color="#000000"><img src="intet.gif" width="1"></font></td>");
document.write("</tr>");
document.write("</table>");
document.write("<font face="Verdana" size="1">");
document.write("<table width="100%" border="0" cellspacing="0" cellpadding="3" height="8">");
document.write("<tr>");
document.write("<td background="gfx/bobbel_bund.gif">");
document.write("<table width="100%" border="0" cellspacing="0" cellpadding="3" height="1">");
document.write("<tr>");
document.write("<td height="1">");
document.write("</tr>");
document.write("</table>");
document.write("</tr>");
document.write("</table>");
document.write("</td>");
document.write("</tr>");
document.write("</table>");
document.write("</table>");
document.write("</DIV>");
<% end if %>
<% end if %>
<%
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
Connect.Close
set Connect = Nothing
%>
Ved det ser uprof ud !