Ver Mensaje Individual
  #8 (permalink)  
Antiguo 12/02/2010, 09:58
nat_chan07
 
Fecha de Ingreso: enero-2010
Mensajes: 62
Antigüedad: 14 años, 4 meses
Puntos: 1
Respuesta: ¿como ejecuto php con javascript?

ah ok :D veré si encuentro algo, gracias

edit:

ejalé ya lo encontré

index.php
Código PHP:
 <html>

<
head>
<
script language="javascript" type="text/javascript">
       function 
MyAjax() {
var 
xmlhttp=false;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (
e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (
E) {
xmlhttp false;
}
}

if (!
xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}

return 
xmlhttp;
}

function 
ClearHTML(sHTML) {
sHTML sHTML.replace(/<[^>]*>/gi"");
sHTML sHTML.replace( /n/gi"") ;
sHTML sHTML.replace(/&nbsp;/gi"");

return 
sHTML;
}
       
</script>

<script language="Javascript" type="text/javascript">
//mensaje de alerta
function mensaje()
{
var miAjaxObj = MyAjax();
miAjaxObj.open("GET","borrar.php",true);
miAjaxObj.send(null);
alert("todos los archivos que ingresó fueron borrados");
}

</script></head>

<body onunload="mensaje();">
</body>
</html> 
borrar.php
Código PHP:
<?php
$filename 
'a.txt';
if(@
file_exists($filename))
{
unlink('a.txt');}
?>

Última edición por nat_chan07; 12/02/2010 a las 10:04