如何从<a href="">到javascript函数
How to send the id of iterator from <a href=""> to javascript function
我想通过链接搜索迭代器的id我试过了,但没有工作
我的链接就像
<s:iterator value="answerswerList" status="id">
<a class="link" href="javascript:countactu_Form('+"%{#id.index}"+')" >add Comment</a>
<div id="Contactu-Form-%{#id.index}" >
<s:textarea name="description" rows="5" cols="60" theme="simple" />
</div>
我的功能就像
function countactu_Form(id){
alert("123456789");
alert(id);
$('#Contactu-Form-'+id).animate({
height: 'toggle'
},150, function() {
// Animation complete.
});
}
请下次发布链接的"视图源"
应用@Umesh的建议并更改脚本以在更多浏览器中工作,请尝试
<a class="link" href="#" onclick="return countactu_Form('<s:property value="%{#id.index}"/>')">add Comment</a>
并更改功能以返回错误
function countactu_Form(id){
$('#Contactu-Form-'+id).animate({
height: 'toggle'
},150, function() {
// Animation complete.
});
return false;
}
相关文章:
- 检测电话窃听,即:<a href="电话:xxx">在UIWebview上
- 图像可以从源<img src=""/>.TEXT可以在没有javascript的情况下从外部
- 在<script src=“"></脚本>标签
- Django,HTML,JS:<img src=“#">可以在HTML中工作,但不能在JS文件中工作
- JSP<a href="">无法保存常规语句
- 在MySQL中存储映像路径与使用<img src=“"onError=“">
- $_POST值在<形式动作=“;javascript:someJSFunction()"/>
- 类似于htmls<script src=“">xaml的标签
- 为什么<车身负载=“;fn()">使用函数调用,但是window.onload=fn;使用处理程序函
- 更改URL而不使用<a href="">
- 为什么可以't我将JS代码置于<script src=“">代码</脚本>
- 如何将鼠标悬停在<img src=“">标签
- 如何设置<一个标题=“">用于erb
- 将用户输入动态地附加到<script src=“">来自Java Script中的文本框
- <a href="#">最终调用Javascript函数
- <a href="javascript:foo(this)">通过Window,我想要标记
- 使用<重置所有字段(复选框、文本、选择);body onload()">
- 如何从<a href="">到javascript函数
- IE总是在<a href="#"/>被单击
- JS:有一个新的运算符"=>&”;