这是我的代码
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<script>
function run() {
document.getElementById("srt").value = document.getElementById("Ultra").value;
}
</script>
<script>
function up() {
//if (document.getElementById("srt").value != "") {
var dop = document.getElementById("srt").value;
//}
alert(dop);
}
</script>
<script>
function up() {
var dop = document.getElementById("srt").value;
pop(dop); // Calling function pop
}
function pop(val) {
alert(val);
}?
</script>
<script type language="javascript">
function cargar_imagen(imagen) {
var img = document.getElementById("myimage");
var img_dir = "http://silvercowgames.com/ENADRYA/imagenes/cartas";
if (img) {
img.src = img_dir + imagen;
}
}
</script>
<select name="imagenes" onchange="run();cargar_imagen(this.value)" id="Ultra1">
<option value="">Imagen 1</option>
<option value="/Johas/Madriguera-Tolva.jpg" >Imagen 2</option>
<option value="/Johas/Coriacia-ancestral.jpg">Imagen 3</option>
<option value="4.png">Imagen 4</option>
</select>
<select id="Ultra"> <!--Call run() function-->
<option value="18">Imagen 1</option>
<option value="16">Imagen 2</option>
<option value="5">Imagen 3</option>
<option value="4">Imagen 4</option>
</select><br><br>
<script>
document.getElementById('Ultra1').addEventListener("change", function () {
document.getElementById('Ultra').selectedIndex = document.getElementById('Ultra1').selectedIndex;
}, false);
</script>
<img alt src="http://silvercowgames.com/ENADRYA/imagenes/cartas/Johas/Coriacia-ancestral.jpg" id="myimage" align="center">
<br>
<form name="frm1">
uno<input type="text" name="uno" id="srt")>
</form>
</body>
</html>
如果执行该操作,您可能会看到当您更改1时选择另一个更改也会更改,但如果您更改并返回到最后一个选项,则txt框中显示的数字会发生变化且不一样。< / p>
我需要在更改选择选项时匹配数字。
请帮帮我