Usar innerhtml javascript
Código Javascript
- Por Programador ASP clásico /
- 05/10/2014 @ 16:59:59 /
- 1173 visitas
Ejemplo 1
<script>function ViewComparison(texto){document.getElementById('prodTable').innerHTML=texto;}</script>
<SELECT id="SubCat" NAME="SubCat" onChange="ViewComparison(this.value);"><Option value="">Product Description</option><Option value="A">A</option><Option value="B">B</option></SELECT><div id="prodTable">Test</div>
Ejemplo 2
<script type="text/javascript">function dest(destination){ if(destination == 0){document.getElementById("demo").innerHTML="<input type=\"text\" name=\"dest\" />"; }else { document.getElementById("demo").innerHTML=""; }}</script>
<form name="signoutForm"><select name="destination" onchange="dest(document.signoutForm.destination.options[document.signoutForm.destination.selectedIndex].value);"><option value="">Choose</option><option value="0">0</option><option value="1">1</option><option value="2">2</option></select></form><div id="demo"></div>
Ejemplo 3
<script>function info(select_element) { var tform = select_element.form; if (tform) { tform.getElementsByTagName("div")[0].innerHTML = select_element.value; tform.getElementsByTagName("div")[1].innerHTML = select_element.getElementsByTagName("option")[select_element.selectedIndex].innerHTML; document.getElementById('caja').innerHTML='informacion: ' + select_element.value; } }</script>
<form onsubmit="return false"> <select name="example_select2" onchange="info(this)"> <option value="1">10000</option> <option value="2">20000</option> <option value="3">30000</option> <option value="4">40000</option> </select> Valor: <div></div> Etiqueta: <div></div> <div id="caja"></div>
Ejemplo 4
<script>function get_filename(obj,fileupid) { var file = obj.value; var disploc = fileupid; document.getElementById('info_' + disploc).innerHTML='Attached: ' + file;}</script>
<select name="example_select3" onchange="get_filename(this,'1');"> <option value="1-100-1-2-3-4-5">10000</option> <option value="3-125-1-2-3-4-5">20000</option> <option value="4-241-1-2-3-4-5">30000</option> <option value="2-250-1-2-3-4-5">40000</option> </select> <div id="info_1"></div> <div id="info_2"></div>
Ejemplo 5
<script>window.copyText = function(sobj){ str = sobj.innerHTML || sobj tobj = document.getElementById('target') if(tobj) tobj.innerHTML = str}</script>
<select name="example_select4" onchange="copyText(this.options[this.selectedIndex].text)"> <option value="1-100-1-2-3-4-5">10000</option> <option value="3-125-1-2-3-4-5">20000</option> <option value="4-241-1-2-3-4-5">30000</option> <option value="2-250-1-2-3-4-5">40000</option> </select>
<input value="(type here then hit tab)" onchange="copyText(this.value)">
<input value="Example Text in INPUT TYPE=BUTTON" onclick="copyText(this.value)" type="button">
<button accesskey="b" onclick="copyText(this)">Example of Text in a <u>B</u>UTTON</button>
<input value="Checkbox's Value" onclick="if(this.checked){ copyText(this.value) } else{ copyText('(unchecked)')}" style="width:25px;" type="checkbox"> Check/Uncheck Box
<div onclick="copyText(this)">Example text in a DIV 1</div>
<table border="1"> <tbody><tr> <td onclick="copyText(this)">Table Row 1,Cell 1</td> <td onclick="copyText(this)">Table Row 1,Cell 2</td> </tr> <tr> <td onclick="copyText(this)">Table Row 2,Cell 1</td> <td onclick="copyText(this)">Table Row 2,Cell 2</td> </tr> </tbody></table> <div id="target"></div>
Estos ejemplos puedes configurarlos
tags:
En esta sección encontrarás una mezcla de códigos recopilados de fuentes públicas de Internet y otros creados por ASP TEAM. Compartimos recursos útiles de buena fe para formar una base de conocimiento en el desarrollo de aplicaciones en ASP Clásico.