我有一个场景,我需要将javascript varibable与jsp页面的scriptlet中的java对象进行比较.如何在jsp scriptlet中获取javascript变量或以其他方式也适用于我(在javascript中获取arraylist对象值).
我有一个场景,我需要将随机生成的id传递给javascript函数,但javascript函数无法识别.我使用dojo增强网格.以下是代码:
function(value, rowIndex) {
var Id = this.grid.getItem(rowIndex).ID;
alert("ID+ " + Id);//retriving the id value correctly
return "<img src=../img/smiley.jpg width=\"20\" height=\"20\" onClick=\"showData(\''+Id +'\')\" class=\"display\">" ;
};
<script>
function showData(id){
alert(id);//unable to get the id here..
}
</script>
Run Code Online (Sandbox Code Playgroud)
提前致谢.