Ver Mensaje Individual
  #11 (permalink)  
Antiguo 09/09/2010, 05:51
Avatar de zerokilled
zerokilled
Javascripter
 
Fecha de Ingreso: abril-2009
Ubicación: Isla del Encanto, La Borinqueña [+>==]
Mensajes: 8.050
Antigüedad: 15 años
Puntos: 1485
Respuesta: Necesito ayuda para reemplazar coincidencias con expresiones regulares

no veo por que te falla pero aqui va un ejemplo.
Código:
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Test Development</title>
<script type='text/javascript'>
self.onload = function(){
alert("left {%c1%} right {%c2%}".replace(/\{%(\w+)%\}/g, function(){
return document.getElementById("cmp"+arguments[1]).value;
}));
};
</script>
<style type='text/css'>

</style>
</head>

<body>
<input id="cmpc1" value="center" />
<input id="cmpc2" value="final" />
</body></html>
__________________
la maldad es una virtud humana,
y la espiritualidad es la lucha del hombre contra su maldad.