Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

ReAdShOtErS

Chamar Comando Automaticamente

Recommended Posts

E aí amigo, beleza?

 

Bom, assim meio por cima, você pode utilizar o comando setTimeout();

Como você não informou o quê quer fazer, a única dica que posso te dar é essa.

 

Procure no google que lá tem muita coisa!

Compartilhar este post


Link para o post
Compartilhar em outros sites

Vou Explicar Melhor

 

O Popup é aberto imediatamente ao entrar no site dai eu quero q ele se feche automaticamente em 5 segundos

Quero por uns baners nele para serem exibidos enquato o site carrega q é cerca de 5 a 10 segundos

 

Tentei fazer Assim mais Não Funcionol

 

<HTML>
<HEAD>
<script LANGUAGE='Javascript'>
<!--
function iniciar()
{
cont=setTimeout("hideMe()", 5000)
}
// -->
</SCRIPT>
</HEAD>
<BODY onLoad='iniciar()'>
</BODY>
</HTML>

Tentei Esse Tamben E Não Funcionol

 

<BODY OnLoad="java script:setTimeout('hideMe()', 2000);">

Esse é o script Do pop-up

 

<head><script language="JavaScript1.2">

// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this header

isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e){
  topDog=isIE ? "BODY" : "HTML";
  whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");  
  hotDog=isIE ? event.srcElement : e.target;  
  while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
	hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
  }  
  if (hotDog.id=="titleBar"){
	offsetx=isIE ? event.clientX : e.clientX;
	offsety=isIE ? event.clientY : e.clientY;
	nowX=parseInt(whichDog.style.left);
	nowY=parseInt(whichDog.style.top);
	ddEnabled=true;
	document.onmousemove=dd;
  }
}

function dd(e){
  if (!ddEnabled) return;
  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
  return false;  
}

function ddN4(whatDog){
  if (!isN4) return;
  N4=eval(whatDog);
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  N4.onmousedown=function(e){
	N4.captureEvents(Event.MOUSEMOVE);
	N4x=e.x;
	N4y=e.y;
  }
  N4.onmousemove=function(e){
	if (isHot){
	  N4.moveBy(e.x-N4x,e.y-N4y);
	  return false;
	}
  }
  N4.onmouseup=function(){
	N4.releaseEvents(Event.MOUSEMOVE);
  }
}

function hideMe(){
  if (isIE||isNN) whichDog.style.visibility="hidden";
  else if (isN4) document.theLayer.visibility="hide";
}

function showMe(){
  if (isIE||isNN) whichDog.style.visibility="visible";
  else if (isN4) document.theLayer.visibility="show";
}

document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");

</script></head>

<body>

<div id="theLayer" style="position:absolute;width:250;left:31;top:26;visibility:visible">
<table border="0" width="250" style="border:1pt solid black" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
  <table border="0" style="background:#FFCEE7" width="100%" cellspacing="0" cellpadding="0" height="36">
  <tr>
  <td id="titleBar" style="cursor:move;padding:2pt;border-bottom:1pt solid black" width="100%">
  <ilayer width="100%" onSelectStart="return false">
  <layer width="100%" onMouseover="isHot=true;if (isN4) ddN4(theLayer)" onMouseout="isHot=false">
  <!-- Coloque aqui o título //-->
  Título da Pop-up
  </layer>
  </ilayer>
  </td>
  <td style="cursor:hand;padding:2pt;border-bottom:1pt solid black" valign="top">
  <p align="right">
  <a href="#" onClick="hideMe();return false">X</a>
  </td>
  </tr>
  <tr>
  <td width="100%" class="td" style="padding:2pt;background:white" colspan="2">
<!-- Coloque o texto aqui //-->  
<div id="menustuff">
Coloque aqui o texto ou mensagem que quiser!
</div>
  </td>
  </tr>
  </table> 
</td>
</tr>
</table></div>
</body>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Eu não tive tempo ainda de avaliar o porquê disso, mas na função hideMe() existe um parâmetro wichDog e isso não está favorecendo o fechamento do popup.

 

Eu renomeei esse wichDog com o id do div onde o popup e está e funcionou.

 

function hideMe(){
  if (isIE||isNN) theLayer.style.visibility="hidden";
  else if (isN4) document.theLayer.visibility="hide";
}

em <body> deixe:

 

<body onLoad="setTimeout('hideMe()',5000);">

Compartilhar este post


Link para o post
Compartilhar em outros sites

não a necessidade de um preload

 

póis só quero exibir um banner e não cobrir toda pagina

 

em todo caso se tiver um script massa de preload eu agradeço se postar

pode me ser util no meu blogspot q demora a beça pra carregar.

 

mais no index do site o pop-up me basta

 

KLONDER

valew awe brigadão cara

funcionol perfeitamente.

 

uma ultima pergunta

 

é possivel rodar esse popup numa index como essa

se sim como ?

 

<HEAD>
<LINK rel="shortcut icon" href="rhd.gif">
<FRAMESET frameborder="0" framespacing="0" border="0" rows="0,*">
	<FRAME>
	<FRAME src="Index.htm"></FRAMESET>
</HEAD>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Acredito não ter nada que impeça esse script de rodar nessa index não. Está dando algum erro no seu código?

Já tentou colocar o script dentro da tag HEAD do seu index?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Alegria de pobre Dura pouco

 

Se Eu coloco o script antes do </Head>

O Site Abre E O popup Não

 

Se Eu Coloco Logo Após O <head>

O Popup Abre e O Site Não

 

<HEAD>
<Title>Teste<Title>
<LINK rel="shortcut icon" href="rhd.gif">
<FRAMESET frameborder="0" framespacing="0" border="0" rows="0,*">
	<FRAME>
	<FRAME src="http://www.google.com.br/"></FRAMESET>
	
<script language="JavaScript1.2" src="http://readshoters.googlepages.com/Popup.js" type="text/javascript"></script>
<body onLoad="setTimeout('hideMe()',5000);">
<div id="theLayer" style="position:absolute;width:250;left:31;top:26;visibility:visible">
<table border="0" width="250" style="border:1pt solid black" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
  <table border="0" style="background:#FFCEE7" width="100%" cellspacing="0" cellpadding="0" height="36">
  <tr>
  <td id="titleBar" style="cursor:move;padding:2pt;border-bottom:1pt solid black" width="100%">
  <ilayer width="100%" onSelectStart="return false">
  <layer width="100%" onMouseover="isHot=true;if (isN4) ddN4(theLayer)" onMouseout="isHot=false">
  <!-- Coloque aqui o título //-->
  Título da Pop-up
  </layer>
  </ilayer>
  </td>
  <td style="cursor:hand;padding:2pt;border-bottom:1pt solid black" valign="top">
  <p align="right">
  <a href="#" onClick="hideMe();return false">X</a>
  </td>
  </tr>
  <tr>
  <td width="100%" class="td" style="padding:2pt;background:white" colspan="2">
<!-- Coloque o texto aqui //-->  
<div id="menustuff">
Coloque aqui o texto ou mensagem que quiser!
</div></td></tr></table></body>
</HEAD>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.