Ver Mensaje Individual
  #8 (permalink)  
Antiguo 30/04/2012, 08:49
wendyl
 
Fecha de Ingreso: marzo-2012
Ubicación: Bogota
Mensajes: 177
Antigüedad: 12 años
Puntos: 2
Respuesta: alert javascript y php

[QUOTE=p414;4173163]podrias poner algo asi[QUOTE]
hola mira este es todo mi codigo del index de mi pagina

Código HTML:
<html>
<head>
<meta http-equiv="refresh" content="60">
	<title>Actualizador BD</title>
	
	<script>
		/*
* Parametros mandatorios
*/
    var seconds = 1; // el tiempo en que se refresca
	var divid = "tabla"; // el div que quieres actualizar!
	var nocacheurl = 'tabla.php';
	
	//var url = "tiempo.php"; // el archivo que ira en el div

	function refreshdiv(){

		// The XMLHttpRequest object

		var xmlHttp;
		try{
			xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari
		}
		catch (e){
			try{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
			}
			catch (e){
				try{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e){
					alert("Tu explorador no soporta AJAX.");
					return false;
				}
			}
		}

		// Timestamp for preventing IE caching the GET request
		var timestamp = parseInt(new Date().getTime().toString().substring(0, 10));
		

		// The code...

		xmlHttp.onreadystatechange=function(){
			if(xmlHttp.readyState== 4 && xmlHttp.readyState != null){
				document.getElementById(divid).innerHTML=xmlHttp.responseText;
				setTimeout('refreshdiv()',seconds*1000);
			}
		}
		xmlHttp.open("GET",nocacheurl,true);
		xmlHttp.send(null);
	}

	// Empieza la función de refrescar

	window.onload = function(){
		refreshdiv(); // corremos inmediatamente la funcion
	}
	
	
	function Datos(){
		//var alerta= "";
		//confirm(alerta );
		nocacheurl='tabladatos.php';
	}
	
	function Voz(){
		//var alerta= "";
		//alert(alerta);
		nocacheurl = 'tablavoz.php';
	}
	function Mintic(){
		//var alerta= "";
		//alert(alerta);
		nocacheurl = 'tablamintic.php';
	}
	function InfoTicket(){
		//var alerta= "";
		//alert(alerta);
		nocacheurl = 'tablainfo_ticket.php';
	}
	function SoporteOS(){
		//var alerta= "";
		//alert(alerta);
		nocacheurl = 'tablasoporte.php';
		
	}
	function MCF(){
		//var alerta= "";
		//alert(alerta);
		nocacheurl = 'tablamcf.php';
	}
	function ActualizarInfo(){
		var alerta= "no hay agentes logueados";
		alert(alerta);
		nocacheurl = 'tablaactualizar_info.php';
	}
	

		

</script>
<style type="text/css">

.estilo1 {
font-family: Trebuchet MS;
font-size: 20px;
color: #000000;
font-weight: bold;
}
</style>

</head>
<body>

<!--alerta.gif -->	
	<?php
//cada boton tiene una imagen.
		$botones='
		<div id="Principal" align="left">
		<button id="Datos" onclick="Datos()">Datos<input type="image" src="images/alarma_apagada1.jpg"/ width="40" height="35"></button>
		<button id="Voz" onclick="Voz()">Voz <input type="image" src="images/alarma_apagada1.jpg" width="40" height="35"/></button>
		<button id="Mintic" onclick="Mintic()">Mintic <input type="image" src="images/alarma_apagada1.jpg" width="40" height="35"/></button>
		<button id="InfoTicket" onclick="InfoTicket()">Info Ticket <input type="image" src="images/alarma_apagada1.jpg" width="40" height="35"/></button>
		<button id="SoporteOS" onclick="SoporteOS()">Soporte o/s <input type="image" src="images/alarma_apagada1.jpg" width="40" height="35"/></button>
		<button id="MCF(" onclick="MCF()">MCF <input type="image" src="images/alarma_apagada1.jpg" width="40" height="35"/></button>
		<button id="ActualizarInfo("onclick="ActualizarInfo()">AIC <input type="image" src="images/alarma_apagada1.jpg" width="40" height="35"/></button>
		Alarma por: <input type="text" name="" value="" /> 
		<img src="images/informe.jpg" width="228" height="290" align="center">
		</div>';
		echo $botones;
		
		echo '<div id="tabla">' ;
		echo "</div>";
		/*alertas 
		Hay una llamada en cola superior a un min
		Hay mas de 2 llamadas en cola
		No hay agentes disponibles
		no hay ningu agente logueado
		
		*/
		
	?>
	

</body>
</html> 
las funciones para los alert las tengo en comentario por que si las pongo pues cada vez que le doy click a cualquier boton me aparecera la alerta