晨希爸比 2021-05-18 14:39 采纳率: 0%
浏览 52

使用js拼接html添加的onclick不能执行

代码如下: function main(source){ var strFrame='

'; strFrame+=''; strFrame+=''; strFrame+='

'; strFrame+='<<'; strFrame+='

'; strFrame+=''; strFrame+=''; strFrame+='

'; strFrame+=now.getFullYear()+'年'+(now.getMonth()+1)+'月'; strFrame+='

'; strFrame+=''; strFrame+=''; strFrame+="

"; strFrame+='>>'; strFrame+='

'; strFrame+=''; strFrame+=''; strFrame+=''; strFrame+=''; strFrame+='

'; strFrame+='日'; strFrame+='

'; strFrame+=''; strFrame+=''; strFrame+='

'; strFrame+='一'; strFrame+='

'; strFrame+=''; strFrame+=''; strFrame+='

'; strFrame+='二'; strFrame+='

'; strFrame+=''; strFrame+=''; strFrame+='

'; strFrame+='三'; strFrame+='

'; strFrame+=''; strFrame+=''; strFrame+='

'; strFrame+='四'; strFrame+='

'; strFrame+=''; strFrame+=''; strFrame+='

'; strFrame+='五'; strFrame+='

'; strFrame+=''; strFrame+=''; strFrame+='

'; strFrame+='六'; strFrame+='

'; strFrame+=''; strFrame+=''; strFrame+=''; var div1=document.getElementById("div1"); var div2=document.getElementById("div2"); if(source=='start'){ div1.innerHTML=strFrame; div2.innerHTML=""; }else{ div2.innerHTML=strFrame; div1.innerHTML=""; } } function prevMonth(){ alert("a"); }
  • 写回答

7条回答 默认 最新

  • CSDN专家-黄老师 2021-05-18 14:48
    关注

    你的onclick事件绑定在那里了?

    评论

报告相同问题?