日期:2014-05-16 浏览次数:20473 次
function display_recom_urls($url_array)
{
echo "<p>推荐给我的所有收藏</p>";
echo "<form name='tj_table' action='../add_tj_bms.php' method='post'>";
echo "<table ><tr><th>收 藏</th><th>加入我的收藏</th></tr>";
foreach($url_array as $url)
{
echo "<tr><td><a href='".htmlspecialchars($url)."'>".$url."</a></td>";
echo "<td align='center'><input type='checkbox' id='isadd' name='add[]' value='".$url."' /></td></tr>";
}
echo "<tr><td><input type='submit' value='加入所选' name='add' /></td></tr>";
echo "</table></form>";
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>checkbox-input</title>
<script language="javascript" type="text/javascript" src="jquery_1.4.2.js"></script>
</head>
<body>
<script>
$(function(){
$("input[name^='poo']").click(function(){
var tid = "apd"+$(this).attr("value");
if($(this).attr("checked")){
$("#"+tid).css({"display":"block"});
}else{
$("#"+tid).css({"display":"none"});
}
});
});
</script>
<div>
<input type="checkbox" name="poo[]" value="1" />p1<input id='apd1' style="display:none" type='text' name='txt' /><br />
<input type="checkbox" name="poo[]" value="2" />p2<input id='apd2' style="display:none" type='text' name='txt' /><br />
<input type="checkbox" name="poo[]" value="3" />p3<input id='apd3' style="display:none" type='text' name='txt' /><br />
</div>
</body>
</html>