1

我通过 JQuery 库中的对象 ModalPopup 创建了一个简单的弹出窗口。这是一个简单的按钮单击事件的事件。我的问题是弹出窗口中的“Javascript”没有运行!当我将弹出窗口作为一个简单的 html 页面打开时,它甚至可以完美运行。

我使用以下代码创建弹出窗口:

$(document).ready(function () {
  //Change these values to style your modal popup

  var align = 'center'; //Valid values; left, right, center
  var top = 100; //Use an integer (in pixels)
  var width = 520; //Use an integer (in pixels)
  var padding = 10; //Use an integer (in pixels)
  var backgroundColor = '#FFFFFF'; //Use any hex code                                                           
  var borderColor = '#333333'; //Use any hex code
  var borderWeight = 4; //Use an integer (in pixels)
  var borderRadius = 5; //Use an integer (in pixels)
  var fadeOutTime = 300; //Use any integer, 0 = no fade
  var disableColor = '#666666'; //Use any hex code
  var disableOpacity = 40; //Valid range 0-100
  var loadingImage = 'images/loading.gif'; //Use relative path from this page
  var source = 'details_company.html';

  //This method initialises the modal popup

  $(".details_company").click(function () {
    modalPopup(align, top, width, padding, disableColor, disableOpacity, backgroundColor, borderColor, borderWeight, borderRadius, fadeOutTime, source, loadingImage);
  });
});

我为我糟糕的英语道歉。

4

2 回答 2

1

看看这个 jquery-ui模态表单示例。它简单易懂。

于 2012-07-27T04:16:04.417 回答
0
$(".details_company").click(function () {
  $("#dialog-modal").dialog({
    height: 140,
    modal: true
  });
});

<div id="dialog-modal" title="Basic modal dialog">
  <p>Adding the modal overlay screen makes the dialog look more prominent because it dims out the page content.</p>
</div>

这使用 jquery-ui

于 2012-07-27T04:01:50.253 回答