Ver Mensaje Individual
  #3 (permalink)  
Antiguo 01/02/2002, 14:13
Avatar de Gurrutello
Gurrutello
 
Fecha de Ingreso: enero-2002
Ubicación: Ontario,Toronto [Canada]
Mensajes: 2.017
Antigüedad: 22 años, 3 meses
Puntos: 6
Re: Ejecutar mensaje en JS

Prueba con este ejemplo<pre> &lt;script language=&quot;JavaScript&quot;&gt;
&lt;!--
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf(&quot;?&quot;))&gt;0&amp;&amp;pare nt.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&amp;&amp;d.all) x=d.all[n]; for (i=0;!x&amp;&amp;i&lt;d.forms.length;i++) x=d.forms[I][n];
for(i=0;!x&amp;&amp;d.layers&amp;&amp;i&lt;d.layer s.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x &amp;&amp; document.getElementById) x=document.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i&lt;(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args);
if (val) { nm=val.name; if ((val=val.value)!=&quot;&quot;) {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p&lt;1 || p==(val.length-1)) errors+='- '+nm+' debe contener datos.\n';
} else if (test!='R') {
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (val&lt;min || max&lt;val) errors+='- '+nm+' debe contener numeros '+min+' y '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' se requiere.\n'; }
} if (errors) alert('Error:\n'+errors);
document.MM_returnValue = (errors == '');
}
//--&gt;
&lt;/script&gt;
&lt;/head&gt;

&lt;body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;&gt;
&lt;form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;&quot;&gt;
&lt;input type=&quot;text&quot; name=&quot;campo&quot;&gt;
&lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;envio&quot; onClick=&quot;MM_validateForm('campo','','R');retu rn document.MM_returnValue&quot;&gt;
&lt;/form&gt; </pre>

un saludo :)


<a href="http://loencuentras.cjb.net"><img src="http://www.mundofree.com/homedesin/loencuentraslogo.gif" alt="Loencuentras.cjb.net" border="0"></a>