duancoubeng5909 2013-02-14 11:28
浏览 55
已采纳

如何在javascript函数中传递2个PHP变量?

How do I pass 2 PHP variables in a javascript function?

This one is working

 echo '<button onClick = "count('.$increment.')">'.$counter.' </button>';

but when i do this

  echo '<button onClick = "count('.$increment.','.$pass.')">'.$counter.' </button>';

it does not work, what is the problem?

By the way these are the variables:

    $increment=5;
    $pass="sdfgd";
  • 写回答

4条回答 默认 最新

  • douzi8916 2013-02-14 11:48
    关注
    echo '<button onClick = "count('.$increment.',\''.$pass.'\')">'.$counter.' </button>';
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?