Jump to content


Photo

Transformar Conteudo Em Variavel


  • Faça o login para participar
12 replies to this topic

#1 Danilo Dantas

Danilo Dantas

    Portal do Humor.com.br

  • Usuários
  • 89 posts
  • Sexo:Não informado

Posted 25/09/2006, 01:04

Eu queria saber, se tem alguma funcao no javascript, que faça o mesmo que a file_get_contents() do PHP faz.

[]'s

Edição feita por: Danilo Dantas, 25/09/2006, 01:31.


#2 Klaus

Klaus

    @ ubuntu jaunty

  • Ex-Admins
  • 7924 posts
  • Sexo:Masculino
  • Localidade:127.0.0.1

Posted 26/09/2006, 13:18

O único arquivo que o Javascript pode ler é um cookie. Você pode ler e gravar nele com document.cookie.
Klaus Paiva
Conheça também: Taperás

#3 bimonti

bimonti

    Super Veterano

  • Usuários
  • 2654 posts
  • Sexo:Masculino

Posted 26/09/2006, 14:32

Com uma ajudinha externa dá pra manipular um XML até que os navegadores suportem plenamente E4X:

var xmlDoc

if (window.ActiveXObject)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async=false;
xmlDoc.load("note.xml")
displaymessage()
}

else (document.implementation && document.implementation.createDocument)
{
xmlDoc= document.implementation.createDocument("","",null)
xmlDoc.load("note.xml");
xmlDoc.onload=displaymessage
}

function displaymessage()
{
document.write(xmlDoc.getElementsByTagName("body")[0].firstChild.nodeValue)
}

;)
WebFórum - Equipe de Desenvolvimento - Monitor
Posted Image
Yeah I do have some stories, and it's true I want all the glory ...

#4 Danilo Dantas

Danilo Dantas

    Portal do Humor.com.br

  • Usuários
  • 89 posts
  • Sexo:Não informado

Posted 26/09/2006, 19:54

Com uma ajudinha externa dá pra manipular um XML até que os navegadores suportem plenamente E4X:

var xmlDoc

if (window.ActiveXObject)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async=false;
xmlDoc.load("note.xml")
displaymessage()
}

else (document.implementation && document.implementation.createDocument)
{
xmlDoc= document.implementation.createDocument("","",null)
xmlDoc.load("note.xml");
xmlDoc.onload=displaymessage
}

function displaymessage()
{
document.write(xmlDoc.getElementsByTagName("body")[0].firstChild.nodeValue)
}

;)


Desculpa, sou pessimo em JS.... Mas como faz pra usar isso?

[]'s

#5 Tobias

Tobias

    Normal

  • Usuários
  • 75 posts
  • Sexo:Masculino
  • Localidade:Queimados - Rio de Janeiro - Perto da Lua
  • Interesses:Conhecimento o_O

Posted 27/09/2006, 11:28

uma solução pra vc seria usar ajax e consultar um arquivo php pra pegar os valores. vo passa um codigo pra te ajudar nisso.

não liga pra simplicidade, eu não so nada bom em js tb :D

funcoes.js

var ajax = new Object();
ajax.Link = function ()
{
try
{
xmlhttp = new XMLHttpRequest();
}
catch(ee)
{
try
{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(E)
{
xmlhttp = false;
}
}
}
return xmlhttp;
}

ajax.LerArquivo = function ()
{
var xmlhttp = ajax.Link();
if (xmlhttp)
{
xmlhttp.open( 'get', 'ler_arquivo.php' );
xmlhttp.onreadystatechange = function ()
{
if (xmlhttp.readyState == 4)
{
var conteudo = xmlhttp.responseText; //Grava a resposta do conteudo na variavel conteudo :D
alert (conteudo); //so pra vc testar e ver se ta correto.
}
}
xmlhttp.send(null)
}
}


ler_arquivo.php

<?

/*
bom eu defini o arquivo aqui mas você poderia passar o nome dele pelo metodo $_GET
porém implicaria em mais proteção nesse arquivo aqui, logicamente.
*/

$arquivo = "arquivo.txt"; //nome do arquivo

header("Content-Type: text/html; charset=ISO-8859-1",true); //Para não ter problemas com acentuação
echo file_get_contents($arquivo); //lendo o conteudo do arquivo e mostrando o na tela.

?>


index.html

<html>
<head>
<title>Lendo Arquivo com AJAX - Simples</title>
<script language="javascript" src="funcoes.js"></script>
</head>
<body>
<a href="java script:void(0);" onclick="ajax.LerArquivo()">Ler Arquivo</a>
</body>
</html>


arquivo.txt (pode tr qualquer coisa dentro dele :D)

bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla


bom põe tudo na mesma pasta e testa ae :D
vlw parcero fui.

há ta em anexo se quiser, bom espero ter ajudado e acho q isso vai te dar base pra fazer o que vc quer.

Anexo abaixo
Attached File  Ler_Arquivo_AJAX.zip   1.48KB   17 downloads
Sites legais

[b][color=#FF9966]Technocil

#6 Danilo Dantas

Danilo Dantas

    Portal do Humor.com.br

  • Usuários
  • 89 posts
  • Sexo:Não informado

Posted 27/09/2006, 19:13

Deu certo :D

Obrigado pela ajuda (y)

#7 Tobias

Tobias

    Normal

  • Usuários
  • 75 posts
  • Sexo:Masculino
  • Localidade:Queimados - Rio de Janeiro - Perto da Lua
  • Interesses:Conhecimento o_O

Posted 02/10/2006, 12:55

q nada precisando e so fala :D
Sites legais

[b][color=#FF9966]Technocil

#8 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 15385 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 25/09/2017, 16:13

purchase accutane online Cialis Viagra Was Ist Besser Cialis Giornaliero Generico cialis price Propecia Cost Rite Aid
Levitra Que Contiene Orlistat 60 Mg Taking Amoxicillin Betaseron cialis Yasmin Aus
Furosemide 40 Mg Canadian Pharmacy Can You Treat Chlamydia With Flagyl 200 Azithromycin For Sale Online cheap cialis Amoxicillin Dosage Adult

#9 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 15385 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 08/10/2017, 04:22

Order Celexa 20 Mg Medications A Vendre Clomid Sur Internet Viagra Forum viagra Viagra Potenzmittel Blog
Cheapest Dutasteride Prescription En Ligne viagra Locacid Kamagra En Vente Libre
Order Now Doxycycline viagra vs cialis vs levitra Levitra Dosage 40mg
Buy Tamoxifen Citrate Australia Buy Strong Viagra Uk 64 viagra Prednisone No Script Canadian Seledruff Is Zithromax Available In India

#10 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 15385 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 02/11/2017, 22:22

Canadian Health Generic Viagra Super Active 100mg Commander Cialis Generic online pharmacy Daly Cialis Canada Priligy Erfarenheter Discount For Plavix
Allergy To Amoxicillin And Clavulanate Potassium Cialis 99 Lilly Cialis Online levitra for sale Cialis Mit Rezept Bestellen

#11 Miguceamma

Miguceamma

    MiguPenjisse

  • Usuários
  • 13201 posts

Posted 03/11/2017, 07:47

Find Dutasteride 0.5mg Cheapeast Medication Mastercard Cash Delivery bayer generic generic levitra 100mg Vendita Cialis In Svizzera Propecia After 1 Month 1mg

#12 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 15385 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 29/11/2017, 12:51

Cealisbuy Kamagra Apcalis Spirulina viagra online The Best Generic Cialis Canadian Pharmacy Viagra Cod Only Acticin Scabies Where To Purchase Medication
On Line Pharmacys In India cialis Levitra Ordering Viagra Generique Doctissimo Generic Viagra Purchase
How To Get Zithromax Kamagra Manufacturers Achat Amoxicillin En Suisse Acheter viagra Cialis En Andorre Snorting Amoxicillin

#13 JeffMalm

JeffMalm

    Super Veterano

  • Usuários
  • 12254 posts
  • Sexo:Feminino
  • Localidade:Mount Carey

Posted 09/02/2023, 20:20

Her unblocked nostril and my other bird s nostrils are kind of pinkish inside, not black what company makes stromectol Epstein Barr virus latent membrane protein 1 induces micronucleus formation, represses DNA repair and enhances sensitivity to DNA damaging agents in human epithelial cells
It is important to assure that the patient has packed red blood cells available propecia no prescription is a clinical psychologist, with a fellowship training in behavioral medicine, working at the intersection of psychology and medicine
1981; 194 585 91 cialis order online




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq