Ted k’ É assim que tem que ser! Programando em ASP, ASP.NET, PHP, CSS, dentre outras…


4
Nov/08
0


Função “três pontinhos”

Código simples para você ter aqueles "três pontinhos" em sua notícia, feeds etc...

 

Usando VBScript

<%@ Language="VBScript" %>
<%
Public Function Pontos(VarTexto, Max) ' Recebemos os valores
	If Int(Len(VarTexto)) > Max Then
		Response.Write(Left(VarTexto, Max)&"...") ' Usamos a função "substring" para fazer os cortes
	Else
		Response.Write(VarTexto)
	End If
End Function

Texto = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the whenwhen, when an unknown printer took a galley of type and scrambled it to make a type specimen book."

Call Pontos(Texto, 150) ' Chamando a função e mostrando o resultado
%>

 

 

Agora usando JScript com ASP

<%@ Language="JScript" %>
<%
function pontos(varTexto, Max) { // Recebemos os valores
	if (varTexto.length > Max) {
		Response.Write(varTexto.substring(0, Max)+"..."); // Usamos a função "substring" para fazer os cortes
	}
	else {
		Response.Write(varTexto);
	}
}

texto = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the whenwhen, when an unknown printer took a galley of type and scrambled it to make a type specimen book.";

pontos(texto, 150); // Chamando a função e mostrando o resultado
%>
28
Jun/08
3


Pegando o nome da Imagem em campo “file”

De tanto a os usuários lá do iMasters perguntarem sobre como pegar o nome da imagem de um campo "input file" decidir criar esse "micro" script para facilitar e deixar aqui no blog para compartilhar, é simples, nada que umas condições não possam fazer, então vamos lá.

Vamos supor que a variável que criei chamada "Caminho_Foto" está recebendo o valor de um Request.Form() e que esse .Form está chamando o resultado de um "input file" lá do formulário de HTML; então vamos.


   Caminho_Foto = "c:\\teste\imagem.gif"
   Response.Write(Right(Caminho_Foto, Len(Caminho_Foto) - InstrRev(Caminho_Foto,"\")))

É só isso mesmo, simples, simples!!!

Dúvidas? postem!

Acesse também: Webly


Página 1 de 11



Portfólio Ted k'

Atualize seu Navegador