HTML 标签超链接

dept.html页面源代码如下:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery.min.js">
	
</script>
<script type="text/javascript">
	$(function() {
		var str = "";
		$.ajax({
			url : "http://localhost:8888/dept",
			dataType : "json",
			type : "get",
			success : function(result) {
				for (var i= 0; i < result.length; i++) {
					 str +="<tr><td>"+result[i].dno+"</td><td>"+result[i].dname+"</td><td>"+result[i].dcity+"</td><td><a href='' onclick='del("+result[i].dno+")'>删除</a></td></tr>"; 
				//<a href=''>A标签 href可以变成超链接,蓝灰色,点击不跳转页面
				//<a href='javaScript:;'>A标签 href可以变成超链接蓝色,点击跳转页面	 
				}
				$('#dept_table').append(str);
			},
			error : function() {
				alert("数据加载失败,AJAX跨域问题");
			}
		})
	})
	
	function del(dno){
		alert(dno);
	}
</script>

</head>
<body>
	<h1>部门管理</h1>
	<table id="dept_table">
	</table>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/xielong0509/article/details/83537154