<input name="radiobutton" type="radio"  value="0" <c:if test="${type==0}">checked</c:if>/>是根据从后台取得的type值让单选选中,想让它选中后再执行一个javascript函数?该怎么写呢

解决方案 »

  1.   

    <input name="radiobutton" type="radio" value="0" onclick="fun()" <c:if test="${type==0}">checked</c:if>/>fun()
    你的函数
      

  2.   

    你可以放到body的onload事件里面,判断radio是否checked,如果是true,执行相应的操作。
      

  3.   


    <input name="radiobutton" type="radio" value="0" onclick="javascript:fun();"/>选中此单选按钮后,执行js的fun()方法。
      

  4.   

    <input name="radiobutton" type="radio" value="0" onclick="fun()" <c:if test="${type==0}">checked</c:if>/>fun()
    你的函数
    这样子函数没有执行哦
      

  5.   

    要求,不是在页面点击单选按钮后才触发事件,要求在这个页面出来时就会根据if是否为true让radio选中,然后再执行一个函数
      

  6.   

    form  onload后取对象的值再判断执行
      

  7.   

    liuyuhua0066 谢谢你,呵呵你的肯定是可以的!
      

  8.   

    <html>
    <head>
    <script>
    function test(){
    alert("Hello!");
    }
    </script>
    </head>
    <body>
    <input type="radio" name="radiobutton" onclick="javascript:test()"/>
    </body>
    </html>你试下...