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

Tem Como?


Guest tito

Pergunta

15 respostass a esta questão

Posts Recomendados

  • 0

bem.. pensei que você só queria se tem como fazer.. :)

se for acessar de onde esta hospedada a pagina tera que utilizar uma linguagem dinamica..

então me fala onde esta o .txt:

No Server onde esta a Pagina? (se for isto só em ASP / PHP)

Ou é na maquina que esta acessando o Site?

Link para o comentário
Compartilhar em outros sites

  • 0

Rob_g2*6(sic)6

La vem Script do Jissa.!!!!!

Sai de perto.......... 

não entendi por que?? hehe mas vai um cabeludo mesmo.. olha troca onde estiver para leiame.txt para o nome do seu arquivo texto ou o nome do seu arquivo texto para leiame.txt :) sua escolha...

Testem este script com um arquivo .HTM / .HTML vao ver que shou de Bola...

Valeu... Enjoy the script

<HEAD>
<script LANGUAGE="JavaScript">
var isDOM = (document.getElementById ? true : false); 
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isDyn = (isDOM || isIE4 || isNS4);

function getRef(id)
{
 if (isDOM) return document.getElementById(id);
 if (isIE4) return document.all[id];
 if (isNS4) return document.layers[id];
}

function getSty(id)
{
 return (isNS4 ? getRef(id) : getRef(id).style);
} 


// *** Carrega arquivo dentro das DIVs ***

function scrLoad(name) { with (this)
{
 if (!name) return;


 var path = location.href.substring(0, location.href.lastIndexOf('/') + 1);

 if (isDOM || isIE4)
 {
  // Carrega documento no buffer
  oldLoc = bufRef.location.href;

  if ((name.substring(0, 5) != 'http:') && (name.substring(0, 5) != 'file:'))
   name = path + name;

  if (isDOM && !document.all) setTimeout(myName + '.bufRef.document.readyState="complete"', 5000);

  if (oldLoc != name)
  {
   bufRef.location.href = name;
   checkBuffer(oldLoc);
  }
  else checkBuffer('dummyLocation');
 }
 else
 {
  divRef.onload = new Function(myName + '.fileLoaded()');
  divRef.load(name, cWidth);
 }
}}

function scrCheckBuffer(oldLoc) { with (this)
{
 if ((bufRef.location.href == oldLoc) || (bufRef.document.readyState != 'complete'))
  setTimeout(myName + '.checkBuffer(\'' + oldLoc + '\')', 50);
 else
 {
  divRef.innerHTML = bufRef.document.body.innerHTML;
  bufRef.location.href = 'about:blank';
  setTimeout(myName + '.fileLoaded()', 1);
 }
}}

function scrFileLoaded() { with (this)
{
 activeScr = null;

 scrollBy(-100000);

 loadSty.visibility = 'hidden';
 for (count = 0; count < divs.length; count++)
  getSty(divs[count][0]).visibility = 'visible';
}}


function scrScrollBy(amount) { with (this)
{
 if (!isDyn || !loaded) return;

 amount = parseInt(amount);

 divHeight = document.all ? divRef.clientHeight : 
  (isDOM ? divRef.offsetHeight : divRef.document.height);
 if (divHeight == 0) divHeight = 1;

 if ((cBot + amount) > divHeight) amount = divHeight - cBot;
 if ((cTop + amount) < 0) amount = 0 - cTop;

 cTop += amount;
 cBot += amount;
 if (isDOM || isIE4)
  divSty.clip = 'rect(' + cTop + 'px ' + cWidth + 'px ' + cBot + 'px ' + 0 + 'px)';
 else if (isNS4)
 {
  if (isNaN(cTop) || isNaN(cBot) || isNaN(amount)) layout();

  if (cBot < divSty.clip.top) divSty.clip.top = cTop;
  divSty.clip.bottom = cBot;
  divSty.clip.top = cTop;
 }

 divSty.top = eval(divs[0][2]) - cTop;


 thmHeight = Math.ceil(barHeight * ((cBot - cTop) / divHeight));

 if (thmHeight < minThmHeight) thmHeight = minThmHeight;
 if (thmHeight > barHeight) thmHeight = barHeight;

 if (isDOM || isIE4) thmSty.height = thmHeight;
 else if (isNS4) thmSty.clip.height = thmHeight;

 if (activeScr) return;

 fracDivDown = (cTop / (divHeight - (cBot - cTop)));
 thmSty.top = parseInt(barSty.top) + fracDivDown * (barHeight - thmHeight);

 if (loop) setTimeout(myName + '.scrollBy(' + amount + ')', loop);
}}


function scrThumbDown(evt)
{
 activeScr = this;

 if (document.all) scrOffset = event.offsetY;
 else scrOffset = evt.layerY;
 return false;
}

function scrThumbMove(evt)
{
 if (isNS4) document.routeEvent(evt);

 if (!activeScr) return true;
 else { with (activeScr)
 {
  if (isNaN(cTop) || isNaN(cBot)) divLayout();

  if ((cBot > divHeight) || (thmHeight == barHeight)) return;

  if (document.all) newTop = document.body.scrollTop + event.clientY - scrOffset;
  else newTop = evt.pageY - scrOffset;

  var barTop = parseInt(barSty.top);
  if (newTop < barTop) newTop = barTop;
  if (newTop + thmHeight > (barTop + barHeight))
   newTop = (barTop + barHeight) - thmHeight;
  thmSty.top = newTop;

  fracDivDown = cTop / (divHeight - (cBot - cTop));
  fracBarDown = (newTop - barTop) / (barHeight - thmHeight);

  scrollBy((fracBarDown - fracDivDown) * (divHeight - (cBot - cTop)));

  return false;
 }}
}

function scrThumbUp(evt)
{
 if (isNS4) document.routeEvent(evt);
 activeScr = null;
}


function scrBarClick(evt) { with (this)
{
 if (isNS4) document.routeEvent(evt);

 if (document.all) clickPos = document.body.scrollTop + event.clientY;
 else clickPos = evt.pageY;

 if (clickPos < parseInt(thmSty.top)) scrollBy(cTop - cBot);
 if (clickPos > (parseInt(thmSty.top) + thmHeight)) scrollBy(cBot - cTop);
}}


function scrLayout() { with (this)
{
 if (!isDyn) return;

 winWidth = document.all ? document.body.clientWidth : window.innerWidth;
 winHeight = document.all ? document.body.clientHeight : window.innerHeight;

 if (isNS4 && (scrFirstWidth != winWidth))
 {
  fileName = location.href;
  if (fileName.indexOf('?') != -1) fileName = fileName.substring(0, fileName.indexOf('?'));
  location.href = fileName + '?loadFile=' + divRef.src;
 }

 if (!loaded) return;

 if (winWidth < minWinWidth) winWidth = minWinWidth;
 if (winHeight < minWinHeight) winHeight = minWinHeight;

 for (count = 0; count < divs.length; count++)
 {
  var tmpObj = getSty(divs[count][0]);
  if (divs[count][1]) tmpObj.left = eval(divs[count][1]);
  if (divs[count][2]) tmpObj.top = eval(divs[count][2]);
  if (divs[count][3])
  {
   var tmpW = eval(divs[count][3]);
   isNS4 ? tmpObj.clip.width = tmpW : tmpObj.width = tmpW;
  }
  if (divs[count][4] && count != 0)
  {
   var tmpH = eval(divs[count][4]);
   isNS4 ? tmpObj.clip.height = tmpH : tmpObj.height = tmpH;
  }
 }

 if ((isDOM || isIE4) && !cTop) cTop = 0;
 if (isNS4) cTop = divSty.clip.top;

 barHeight = eval(divs[1][4]);
 cBot = cTop + eval(divs[0][4]);
 cWidth = eval(divs[0][3]);
 if (isDOM || isIE4) divSty.width = cWidth;

 scrollBy(0);
}}


function scrSetup(defaultFile) { with (this)
{
 if (!isDyn) return;

 divRef = getRef(divs[0][0]);
 divSty = getSty(divs[0][0]);
 barSty = getSty(divs[1][0]);
 thmSty = getSty(divs[2][0]);
 loadSty = getSty(loadSty);
 bufRef = eval('window.' + bufRef);

 barRef = getRef(divs[1][0]);
 thmRef = getRef(divs[2][0]);

 if (isNS4)
 {
  barRef.captureEvents(Event.CLICK);
  thmRef.captureEvents(Event.MOUSEDOWN);
  document.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);
 }

 barRef.onclick = new Function('evt', 'return ' + myName + '.barClick(evt)');
 thmRef.onmousedown = new Function('evt', 'return ' + myName + '.thumbDown(evt)');
 document.onmousemove = scrThumbMove;
 document.onmouseup = scrThumbUp;

 if (document.all) document.onselectstart = new Function('if (activeScr) return false');
 else if (isDOM) document.onselect = new Function('if (activeScr) return false');


 loaded = true;
 layout();


 fileName = '';
 if (location.href.indexOf('?') != -1)
  fileName = location.href.substring(location.href.lastIndexOf('=') + 1);

 if (fileName.indexOf('.htm') != -1) load(fileName)

 else if (defaultFile) load(defaultFile);
 else fileLoaded();
}}


function DHTMLScroller(myName, bufferID, loadMess)
{
 this.divRef = null;
 this.divSty = null;
 this.barSty = null;
 this.thmSty = null;

 this.divs = new Array();

 this.loadSty = loadMess;
 this.bufRef = bufferID;
  
 this.myName = myName;
 this.loaded = false;
 this.loop = 0;
 this.minThmHeight = 20;

 this.divHeight = 0;
 this.barHeight = 0;
 this.thmHeight = 0;
 this.cTop = 0;
 this.cBot = 0;
 this.cWidth = 0;

 this.load = scrLoad;
 this.checkBuffer = scrCheckBuffer;
 this.fileLoaded = scrFileLoaded;
 this.scrollBy = scrScrollBy;
 this.thumbDown = scrThumbDown;
 this.barClick = scrBarClick;
 this.setup = scrSetup;
 this.layout = scrLayout;
}

var activeScr = null, scrOffset = 0, winWidth, winHeight, scrFirstWidth = window.innerWidth;

var mainDiv;

var minWinWidth = 500, minWinHeight = 300;

mainDiv = new DHTMLScroller('mainDiv', 'bufferFrame', 'loadMess');

with (mainDiv)
{
 divs[0] = new Array('mainContentDiv', '50', '50', 'winWidth - 150', 'winHeight - 100');
 divs[1] = new Array('scrollBar', 'winWidth - 95', '90', '15', 'winHeight - 175');
 divs[2] = new Array('scrollThumb', 'winWidth - 94', '', '13', '');

 divs[3] = new Array('upArrows', 'winWidth - 95', '50', '', '');
 divs[4] = new Array('downArrows', 'winWidth - 95', 'winHeight - 85', '', '');
}



function scrCheckKeys(evt) { with (mainDiv)
{
 if (!loaded) return;
 if (document.all) key = event.keyCode;
 else if (isDOM) key = evt.charCode;
 else if (isNS4) key = evt.which;

 if ((key == 84) || (key == 116)) scrollBy(-100000); // 'T' = Top.
 if ((key == 65) || (key == 97))  scrollBy(-10);     // 'A' = Up.
 if ((key == 90) || (key == 122)) scrollBy(10);      // 'Z' = Down.
 if ((key == 66) || (key == 98))  scrollBy(100000);  // 'B' = Bottom.
}}

if (isNS4) document.captureEvents(Event.KEYPRESS);
document.onkeypress = scrCheckKeys;

//<style>
//absDiv { position: absolute; visibility: hidden }

//</style>
</script>

</HEAD>
<style> 
.absDiv { position: absolute; visibility: hidden }
</style>

<BODY scroll="no" onLoad="mainDiv.setup('leiame.txt')" onResize="mainDiv.layout()">

<div id="loadMess" style="position: absolute; left: 200; top: 200">
<font face="Arial, Helvetica" size="5">Por Favor Aguarde... Carregando...</font></div>

<iframe name="bufferFrame" class="absDiv" style="width: 0; height: 0; top: -20"></iframe>

<div id="mainContentDiv" class="absDiv"></div>

<div id="upArrows" class="absDiv">
<a href="javascript:mainDiv.scrollBy(-100000)" title="Volta para o Topo (T)">Topo</a><br>
<a href="javascript:void(0)" onMouseDown="mainDiv.loop=50; mainDiv.scrollBy(-10); return false"
 onMouseUp="mainDiv.loop=0" onMouseOut="mainDiv.loop=0" title="Sobe Texto (A)">Sobe</a>
</div>

<div id="scrollBar" class="absDiv" style="background: #666666;
 layer-background-color: #666666; cursor: hand"></div>

<div id="scrollThumb" class="absDiv" style="background: #CCCCCC;
 layer-background-color: #CCCCCC; cursor: move" ondragstart="return false"></div>

<div id="downArrows" class="absDiv">
<a href="javascript:void(0)" onMouseDown="mainDiv.loop=50; mainDiv.scrollBy(10); return false"
 onMouseUp="mainDiv.loop=0" onMouseOut="mainDiv.loop=0" title="Desce Texto (Z)">Abaixa</a><br>
<a href="javascript:mainDiv.scrollBy(100000)" title="Vai para o Final do Texto (B)">Fim do Texto</a>
</div>


<div style="position: absolute; top: 10; left: 15">
<a href="javascript:mainDiv.load('leiame.txt')">Recarrega o Arquivo (reload)</a>
</div>
</center><p>

Link para o comentário
Compartilhar em outros sites

  • 0

nossa jissa....esse ai detonou!!!.... muito loco.....hehehe

só q eu não consegui usar com o html ou htm...

depois eu tento de novo.... :)

parabens...hehehehe

Link para o comentário
Compartilhar em outros sites

  • 0

DirAol... é só trocar onde esta o leiame.txt para o arquivo.htm(l), ele tem que estar no mesmo diretorio do programa ai..

se colocar no server o script e o .txt ou outro arquivo devera estar sempre no mesmo diretorio..

de nada Tito(vitor)... já que levou este belo script na faixa.. se cadastra ai no Forum e nos prestigie com sua presença. :)

Link para o comentário
Compartilhar em outros sites

  • 0

Obrigado... so montei umas funcoes que tinha aqui...

Wallacem... pena que por pouco tempo.. tvz não apareça muito.. to com uma proposta ai.. se tudo der certo acho que não terei muito tempo para vir no forum..

ai vejo em finais de semana o que não foi respondido e tento responder.. mas tem muita gente fera por aqui...

poderoso este script.. se souber utiliza-lo em conjunto ASP (activeX) fica uma ferramenta muito forte... mas isto não pode ser discutido aqui.. né não..

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
      651,8k
×
×
  • Criar Novo...