zoukankan      html  css  js  c++  java
  • js简单的获取与输出

    js获取标签内容和输出内容到页面

    获取:

    html: 

    <select id="choiceSelect" onchange="changeImg()">
      <option value="1">石头</option>
       <option value="2">剪刀</option>
       <option value="3"></option>
    </select>
    <img src="img/1.png" id="img1">

    js:

    <script type="text/javascript">
            var n1 = 1;function changeImg(){
                var changeImg = document.getElementById("choiceSelect");
                n1 = changeImg.value;
                // alert(n1);
                document.getElementById("img1").src="img/"+n1+".png";
            }</script>

    输出:

    html: <p id = "finalresult"></p>

    js: document.getElementById("finalresult").innerHTML = "输出的内容";

  • 相关阅读:
    Flask--目录
    Linux相关目录
    Mac 提示错误”xcrun: error“
    subprocess模块
    压缩模块
    GitPython模块
    Ansible-ansible命令
    YAML语法
    Ansible-安装
    Ansible-概念
  • 原文地址:https://www.cnblogs.com/makangning/p/9373948.html
Copyright © 2011-2022 走看看