我有一个带有jQuery对话框的用户控件。jQuery对话框具有用于打开网页的iframe test1.aspx。我还有一个网页具有jQuery对话框,其中对话框也具有用于打开网页“ test2.aspx”的iframe。如果用户控件不在同一网页中,则这两个对话框可以正常工作。将两个对话框放在同一页面上。用户控件上的jQuery对话框一直显示test2.aspx,而不是test1.aspx。有时,对话框的位置位于用户控制附近的链接下。该对话框旨在在顶部打开。
用户控件上有代码段:
<a title="Edit" onclick="openBoxTest('test1.aspx?id=659333','test',650,310, 'dialog1'); return false">Edit</a>
<div id="dialog1"> <iframe id="myIframe" src="" ></iframe></div>
网页上有代码段:
<span onclick="openBoxTest('/test2.aspx?ID=652','test2',650,310, 'dialog2'); return false" >test2</span>"
<div id="dialog2"> <iframe id="myIframe" src="" ></iframe></div>
有用于打开对话框的脚本:
function openBoxTest(url, name, width, height, divID) {
var box = $('#' + divID);
box.dialog({
autoOpen: false,
max_height: 'auto',
height: 'auto',
width: 'auto',
title: name,
modal: true,
position: {
my: 'top',
at: 'top',
of: window,
collision: "flip"
},
create: function (event, ui) {
$(event.target).parent().css('position', 'fixed');
},
open: function (ev, ui) {
$('#myIframe').css('height', height+60);
$('#myIframe').css('width', width);
$('#myIframe').attr('src', url);
},
});
box.dialog('open');
return false;
}
很难理解您所描述的内容,但是我的第一个猜测是在dialog1和dialog2内的两个iframe都具有ID = myIframe。如果它们在同一页面上,这可能是您的问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句