dongsutao8921 2013-04-24 21:55
浏览 122
已采纳

onclick没有调用我的javascript函数[关闭]

I am trying to call a javascript function from an onclick, but it does not seem to be registering. I am having trouble tracking down the issue because no error is being reported in chrome inspect element.

MY button code looks like this:

$button = "<button class=\"btn btn-mini btn-success\" id = \"$divName\" onClick\"return upVote($linkID, $linkUser)\">$votes Votes</button>";

and my java script looks like this:

function upVote(id, userID)
    {


        alert(id);




        return false;
    }

you can try out the buttons on the blog link tab on this page:

http://www.beerportfolio.com/beerPage2.php?id=f5DoHi

  • 写回答

2条回答 默认 最新

  • dsklzerpx64815631 2013-04-24 21:57
    关注

    You are missing the "=" in

    onClick=\"return upVote($linkID, $linkUser)\"
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 MapReduce实现倒排索引失败
  • ¥15 luckysheet
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题