Ir para conteúdo
Fórum Script Brasil
  • 0

Barra De Rolagem Automática, Me Ajudem!


Guest Ludson

Pergunta

Me ajudem por favor,

achei um excelente script de Chat, com envio de emoticons(como da uol), mensagem reservado e refresh automático, mas tem um problema, não tem rolagem automática.

Alguém tem um código para fazer uma barra de rolagens automática, conforme vão aparecendo as mensagens?????

Agradeço! ph34r.gif

Link para o comentário
Compartilhar em outros sites

6 respostass a esta questão

Posts Recomendados

  • 0

Opa.. pera ai.. se o DB tiver em ASP ele vai ter que mostrar os ultimos X registros... e posicionar no ultimo.

Se se for em .txt ai sim que a coisa complica... manda para o JavaScript mesmo..

Ludson... explica melhor como é a estrutura do Chat ai...

Link para o comentário
Compartilhar em outros sites

  • 0
Opa.. pera ai.. se o DB tiver em ASP ele vai ter que mostrar os ultimos X registros... e posicionar no ultimo.

Se se for em .txt ai sim que a coisa complica... manda para o JavaScript mesmo..

Ludson... explica melhor como é a estrutura do Chat ai...

Tipo, é um chat em asp, não possui DB nem .txt

aí vai o código do sistema: ph34r.gif

-------------------------------\\-------------------------------------\\------------------------

<%

If Session("logon") = false then

Response.Redirect("expire.asp")

End IF

%>

<%

Function mau(msg)

msg=lcase(msg)

mau=false

if instr(1, msg, "p*** que pariu") then mau=true

if instr(1, msg, "p****") then mau=true

if instr(1, msg, "c******") then mau=true

if instr(1, msg, "******") then mau = true

if instr(1, msg, "******") then mau = true

if instr(1, msg, "vai tomar no") then mau = true

if instr(1, msg, "p***") then mau = true

if instr(1, msg, "merda") then mau = true

if instr(1, msg, "b***") then mau = true

if instr(1, msg, "pinto") then mau = true

if instr(1, msg, "pênis") then mau = true

if instr(1, msg, "filho da p***") then mau = true

end function

Function image(pic, post)

if pic <> "none" then

post = post & ".........<img src='" & pic & "'><br>"

image = post

else

image = post

End If

End Function

'************************************************

dim origem, destino, reserv, msg, id, acao, varid1, varid2, p3, p4, p5, pic

reserv = Request.Form("Reservado")

msg = Request.Form("msg")

id = Request.Form("destinatario")

acao = Request.Form("action")

if id = "1234" then destino = "TODOS" & reserv

pic = Request.Form("imagem")

'Transforma msg para evitar erros no JavaScript

msg = Server.HTMLencode(msg)

If trim(msg) <> "" then 'Postou mensagem

a = Application("id01")

b = Application("nome01")

c = Application("msg01")

l = Application("last01")

For i = 0 to 29 'Procura usuario

if a(i) = Session.SessionID then

origem = b(i)

exit for

End if

next

If origem="" then

Session("logon") = false

session("last") = true

response.redirect("expire.asp")

End If

for i = 0 to 29 'Procura vitima

if a(i) = id then

destino = b(i)

exit for

end if

next

'personaliza as acoes

Select Case acao

Case "grita com"

msg = "<b>" & ucase(msg) & "</b>"

End Select

if reserv <> false then 'Prive

p1 = "<font color = blue>(" & FormatDateTime(now, 3) & ")</font> "

p2 = "<font color = red><b>" & origem & "</b></font> "

p3 = "<font color = blue>reservadamente " & acao & " </font>"

p4 = "<font color = red><b>" & destino & "</b></font>: "

p5 = "<font color = blue><i>" & msg & "</i></font><br>"

post = p1 & p2 & p3 & p4 & p5

post = image(pic, post)

if mau(msg) then

post = post & "<b>BOT para " & origem & ": BOCA-SUJA!<b><br>"

end if

if id = "1234" then

post = "<b>BOT para " & origem & ": pra quê falar reservadamente com todos???</b><br>"

End If

for i = 0 to 29

if a(i) = id or a(i) = Session.SessionID then

c(i) = c(i) & post

end if

next

else 'todos veem a msg

p1 = "<font color = black>(" & FormatDateTime(now, 3) & ")</font> "

p2 = "<font color = blue><b>" & origem & "</b></font> "

p3 = "<font color = black> " & acao & " </font>"

p4 = "<font color = blue><b>" & destino & "</b></font>: "

p5 = "<font color = black>" & msg & "</font><br>"

post = p1 & p2 & p3 & p4 & p5

post = image(pic, post)

if mau(msg) then

post = post & "<b>BOT para " & origem & ": BOCA-SUJA!<b><br>"

end if

for i = 0 to 29

'if c(i) <> "" then

c(i) = c(i) & post

'end if

next

'Adiciona as 10 ultimas

for i = 1 to 8

l(i) = l(i+1)

next

l(9) = post

end if

Application.lock

Application("msg01") = c

Application("last01") = l

Application.unlock

else

a = Application("id01")

b = Application("nome01")

For i = 0 to 29 'Procura usuario

if a(i) = Session.SessionID then

origem = b(i)

exit for

End if

next

end if

chatn = Session("chatn")

%>

<form action="f_post.asp" method="post" name="envia">

<table border="0" cellpadding="2" cellspacing="2" width="100%">

<tbody>

<tr>

<td colspan="2"><b><% Response.write origem %></b><input

name="Reservado" type="checkbox" value="false"><font face="Arial"

size="2">reservadamente&nbsp; </font><select name="Action" size="1">

<option selected value="fala para">fala para</option>

<option value="pergunta para">pergunta para</option>

<option value="responde para">responde para</option>

<option value="concorda com">concorda com</option>

<option value="discorda de">discorda de</option>

<option value="desculpa-se com">desculpa-se com</option>

<option value="surpreende-se com">surpreende-se com</option>

<option value="murmura para">murmura para</option>

<option value="sorri para">sorri para</option>

<option value="suspira por">suspira por</option>

<option value="flerta com">flerta com</option>

<option value="não tá nem aí com">não tá nem aí com</option>

<option value="entusiasma-se com">entusiasma-se com</option>

<option value="ri de">ri de</option>

<option value="dá um fora em">dá um fora em</option>

<option value="briga com">briga com</option>

<option value="grita com">grita com</option>

<option value="xinga">xinga</option>

</select> <select name="destinatario" size="1">

<option selected value="1234">TODOS</option>

<%

varid1 = application("nome01")

varid2 = application("id01")

for i = 0 to 29

if varid2(i) <> Session.SessionID and varid2(i) <> "" then

response.write "<option value=" & varid2(i) & ">" & varid1(i) & "</option>" & vbcrlf

End If

next

%>

</select></td>

</tr>

<tr>

<td width="32"><a href="sai.asp" target="_top"><img alt="Sair"

border="0" src="sair.gif" width="32" height="32"></a></td>

<td>&nbsp;&nbsp;&nbsp;<select name="imagem" size="1">

<option selected value="none">Enviar imagem</option>

<option value="boia.gif">Bóia</option>

<option value="briga.gif">Briga</option>

<option value="cerveja.gif">Cerveja</option>

<option value="coco.gif">Cocô</option>

<option value="desculpa.gif">Desculpa</option>

<option value="drink.gif">Drink</option>

<option value="entusiasmo.gif">Entusiasmo</option>

<option value="flerta.gif">Tubarão</option>

<option value="naotanemai.gif">Não estou nem aí</option>

<option value="nuvem.gif">Nuvem</option>

<option value="presente.gif">Presente</option>

<option value="rosa.gif">Rosa</option>

<option value="sapo.gif">Sapo</option>

<option value="xixarrao.gif">Xixarrão</option>

<option value="pergunta.gif">Interrogação</option>

<option value="ride.gif">Riso</option>

<option value="sorri.gif">Sorriso</option>

</select> &nbsp;<input name="msg" size="50"> <input name="Submit"

type="submit" value="Enviar">&nbsp;&nbsp;&nbsp; Sala: <b>Êxodo</b></td>

</tr>

</tbody>

</table>

</form>

<script language=JavaScript>

function foco(){

var Form

Form = document.envia ;

Form.msg.focus();

}

</SCRIPT>

Link para o comentário
Compartilhar em outros sites

  • 0

Tipo, o código acima é da página de envio de mensagens, abaixo segue o código do chat: ph34r.gif

Página: Frame.asp

<%

Dim a, b, c, d, t, logon, u, i, nome, p1, p2

nome = Request.Form("nome")

if nome = "" then

Response.Redirect("default.asp")

end if

If Application("chatn") = 30 then

Response.Redirect("default.asp?lotada=true")

End If

If Session("logon") = false then

a = Application("id01")

For i = 0 to 29

If a(i) = "" then exit for

next

Session("vaga") = i

a = Application("id01")

b = Application("nome01")

a(i) = Session.SessionID

b(i) = nome

p1 = "<font color=cyan>(" & FormatDateTime(now, 3) & ")</font> "

p2 = "<font color=white>" & nome & " entrou na sala...</font><br>"

logon = p1 & p2

Application.Lock

Application("id01") = a

Application("nome01") = b

Application.unlock

'Adiciona logon as 10 ultimas

u = Application("last01")

for i = 0 to 3

u(i) = u(i+1)

next

u(9) = logon

Application.Lock

Application("last01") = u

chatn = Application("chatn") + 1

Application("chatn") = chatn

Application.unlock

Session("logon") = true

'Avisa o restante dos usuarios que alguém entrou...

c = Application("msg01")

for i = 0 to 29

if i <> Session("vaga") Then

c(i) = c(i) & logon

End If

next

Application.lock

Application("msg01") = c

Application.unlock

End If

%>

<html>

<script language="javascript">

var docflag = new String("C")

function msgpost(msg) {

var destino = parent.frames[0].document

var as = unescape("%34")

if (docflag == "C") {

destino.write("<html><link rel='stylesheet' href='style.css' type='text/css'>")

destino.write("<body topmargin=4 leftmargin=4 bgcolor='#COCOCO' text='#FFFFFF'><p>")

docflag="O" }

destino.write(msg)

parent.frames[1].scroll(0,900000000)

}

</script>

<head>

<% Response.Write "<title>" & nome & " no Chat</title>" %>

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      652k
×
×
  • Criar Novo...