我有一个 jQuery 函数,可以打开一个模式弹出窗口,并且在同一个文件中有一个 PHP 变量,例如$url="iteminfo.php?ID=".$i['itmid'];
($i['itmid']
是 MySQL 中某些产品的 id)。jQuery 函数如下所示:
<script type="text/javascript">
$(document).ready(function(Surl) {
var source="iteminfo.php?ID=<?echo $i['itmid']?>";
var width = 920;
var align = "center";
var top = 100;
var padding = 10;
var backgroundColor = "#FFFFFF";
var borderColor = "#000000";
var borderWeight = 4;
var borderRadius = 5;
var fadeOutTime = 300;
var disableColor = "#666666";
var disableOpacity = 40;
var loadingImage = "js/popup/loading.gif";
$(".modal").click(function() {
modalPopup( align,
top,
width,
padding,
disableColor,
disableOpacity,
backgroundColor,
borderColor,
borderWeight,
borderRadius,
fadeOutTime,
source,
loadingImage );
});
$(document).keyup(function(e) {
if (e.keyCode == 27) {
closePopup(fadeOutTime);
}
});
});
</script>
它会打开相应的链接,但该函数会像循环一样打开所有链接。如何$url
将 jQuery 函数传递给相应产品以打开相应链接?