My favorites
▼
|
Sign in
lineadecodigo
Web Code Samples in spanish
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
lineadecodigo_web
/
WebContent
/
scripting
/
javascript
/
cadenas
/
implementandonos-funcion-replace.html
r480
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Implementandonos la función replace</title>
<script type="text/javascript">
function replace(texto,s1,s2){
return texto.split(s1).join(s2);
}
function cambiartexto(area,s1,s2){
// Obtenemos el valor del area de texto
texto = area.value;
// Cambiamos su valor
area.value = replace(texto,s1,s2);
}
</script>
</head>
<body>
<h1>Implementandonos la función replace</h1>
<form id="formulario">
<textarea rows="10" cols="50" id="texto">En un lugar de la mancha de cuyo nombre no quiero acordarme...</textarea>
<br>
Cadena 1: <input type="text" id="cadena1" size="50"/><br>
Cadena 2: <input type="text" id="cadena2" size="50"/>
<input type="button" value="Remplazar" onClick="cambiartexto(document.getElementById('texto'),document.getElementById('cadena1').value,document.getElementById('cadena2').value);"/>
</form>
<br><br>
<hr>
Artículo disponible en: <a href="http://lineadecodigo.com/2009/03/12/implementarnos-la-funcion-replace-de-javascript/">http://lineadecodigo.com/2009/03/12/implementarnos-la-funcion-replace-de-javascript/</a><br/>
<a href="http://lineadecodigo.com" title="Linea de Codigo">lineadecodigo.com</a>
</body>
</html>
Show details
Hide details
Change log
r114
by vcuervo on Mar 11, 2009
Diff
Implementarnos la función replace de javascript
Go to:
...mentandonos-funcion-replace.html
Project members,
sign in
to write a code review
Older revisions
All revisions of this file
File info
Size: 1393 bytes, 41 lines
View raw file
Powered by
Google Project Hosting