I am new to jquery. I wanted to generated a set of image button so i have done like this
<script type="text/javascript">
$(document).ready(function(){
$.support.cors = true;
if ($( #ulTask li ).length == 0)
{
$.ajax({
type: "POST",
url: "http://diana/TaskManagerWebService/TaskManagerService.asmx/SelectAllTasks",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
error: OnError
});
function OnSuccess(TaskData){
var TaskDataObj = jQuery.parseJSON(TaskData.d);
$.each(TaskDataObj, function (i, v) {
var TaskTypeUrl = getTaskTypeImageURL(TaskDataObj[i].TaskType), TaskId = parseInt(TaskDataObj[i].TaskId);
$("#ulTask").append( <li id="liTask +TaskDataObj[i].TaskId+ "><div id="divTask +TaskDataObj[i].TaskId+ "><img id="imgCollapse +TaskDataObj[i].TaskId+ " alt=" + TaskDataObj[i].TaskId + " src="Images/story_collapsed1.png" onclick="javascript:FillTaskDetails( +TaskDataObj[i].TaskId+ );"/> + TaskDataObj[i].TaskName + </div></li> );
});
}
function OnError(request, status, error){
alert(request.statusText);
}
}
});
</script>
用于一对冲束的图像,有点击。
onclick="javascript:FillTaskDetails( +TaskDataObj[i].TaskId+ );"
我想在问候中指定这一点击事件,像对待囚犯一样。
$("#imageId").click(function(){
});
如何实现这一“理想”, 实际上,这种形象是文字和动态价值的结合。
<img id="imgCollapse +TaskDataObj[i].TaskId+ ".......
预 收