zoukankan      html  css  js  c++  java
  • 页面上拼写列表时 onclick="",左斜线表示转意,告诉程序这是双引号

    td += "<tr><td><input type='checkbox' name='siteChoice' id='siteChoice"+newKey+"' onclick='changeCheck(this)' value='"+key+"'/><span id='choice"+newKey+"'>"+(j+1)+"</span></td>"+
    "<td>"+terminalName+"</td>"+
    "<td>"+unitName+"</td>"+
    "<td ><input type='hidden' id='siteStatus"+newKey+"' value='"+siteStatus+"'/><a class='"+siteStatusClassName+"' href='javascript:void(0);' id='siteStatusButton"+newKey+"' onclick="changeThisSiteStatus('"+newKey+"')"></a></td>"+
    "<td><input type='hidden' id='isQuiet"+newKey+"' value='"+isQuiet+"'/><a class='"+quietClassName+"' href='javascript:void(0);' id='isQuietButton"+newKey+"' onclick="changeThisSiteQuiet('"+newKey+"')"></a></td>"+
    "<td ><input type='hidden' id='isMute"+newKey+"' value='"+isMute+"'/><a class='"+muteClassName+"' href='javascript:void(0);' id='isMuteButton"+newKey+"' onclick="changeThisSiteMute('"+newKey+"')"></a></td>"+
    "<td><div class='dragItem'>"+key+"</div></td>"+
    "<td><input type='text' value='0' id='vol"+newKey+"' onkeyup='replayStr(this)' onafterpaste='replayStr(this)' style='30px'><a href='javascript:void(0)' onclick="changeVolume('"+newKey+"')">设置</a></td>"+
    "<td><a href='javascript:void(0)' onclick="moveUp('"+newKey+"')">向上</a>"+
    "<a href='javascript:void(0)' onclick="moveDown('"+newKey+"')">向下</a></td>"+
    "</tr>";

    问题:<a href='javascript:void(0)' onclick='moveUp("+newKey+")'>向上</a>

    原因是该参数必须要用单引号

      以上是用调试工具看newKey参数值为02720 类型为String

      而在js function moveUp(uri){

          alert(uri)//uri为1488 类型为number

    }

  • 相关阅读:
    洛谷 P4160 [SCOI2009]生日快乐 题解
    洛谷 P1041 传染病控制 题解
    洛谷 P3154 [CQOI2009]循环赛 题解
    洛谷 P1144 最短路计数 题解
    洛谷 P2296 寻找道路 题解
    洛谷 P1514 引水入城 题解
    洛谷 P2661 信息传递 题解
    洛谷 P3958 奶酪 题解
    洛谷 P3501 [POI2010]ANT-Antisymmetry 题解
    【LGR-069】洛谷 2 月月赛 II & EE Round 2 Div.2 A-C题解
  • 原文地址:https://www.cnblogs.com/jcfxl/p/5734097.html
Copyright © 2011-2022 走看看