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
/
pagina
/
modificar-enlace.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
42
43
44
45
46
47
48
49
50
<!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>Modificar el enlace</title>
<script type="text/javascript">
function modificar(url,texto,destino){
document.getElementById("mienlace").innerHTML = texto;
document.getElementById("mienlace").href = url;
document.getElementById("mienlace").target = destino;
}
</script>
</head>
<body>
<h1>Modificar el enlace</h1>
<h2>Enlace</h2>
<a href="http://www.google.com" target="_blank" title="Google" id="mienlace">Google</a>
<h2>Modificar el enlace</h2>
<form action="#">
<label for="enlace">URL: </label><input type="text" id="enlace"><br>
<label for="texto">Texto: </label><input type="text" id="texto"><br>
<label for="destino">Target: </label>
<select id="destino">
<option value="_blank">Nueva Ventana</option>
<option value="_self">Misma ventana</option>
<option value="_parent">Ventana Padre</option>
<option value="_top">Top</option>
</select><br>
<button onClick="modificar(getElementById('enlace').value,getElementById('texto').value,getElementById('destino').value);">Cambiar enlace</button>
</form>
<br><br>
<hr>
Artículo disponible en: <a href="http://lineadecodigo.com/2008/02/29/modificar-los-enlaces-con-javascript/">http://lineadecodigo.com/2008/02/29/modificar-los-enlaces-con-javascript/</a><br/>
<a href="http://lineadecodigo.com" title="Linea de Codigo">lineadecodigo.com</a>
</body>
</html>
Show details
Hide details
Change log
r33
by vcuervo on Feb 28, 2008
Diff
Modificar los enlaces de una página con JavaScript
Go to:
...ipt/pagina/modificar-enlace.html
Project members,
sign in
to write a code review
Older revisions
All revisions of this file
File info
Size: 1590 bytes, 50 lines
View raw file
Powered by
Google Project Hosting