所有我想是这样的:为什么fancybox没有出现在这里?
$('#divEditable2').fancybox();
当然我试过了,但是当它没有工作,我甚至尝试了这一点。仍然没有输出。
这里是我的全码:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="fbTest.aspx.cs" Inherits="InlineEditing.fbTest" %>
<!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 runat="server">
<title></title>
<script src="../jquery-1.4.3.min.js" type="text/javascript"></script>
<script src="jquery.fancybox-1.3.4.pack.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="~/Scripts/fancybox/fancybox/jquery.fancybox-1.3.4.css"
media="screen" />
<script type="text/javascript">
$(document).ready(function() {
$('#btn').click(function() {
alert('loading...');
var divObject = document.createElement('div');
divObject.setAttribute('id', 'divEditable2');
var editorContent = '<textarea rows="5" cols="55">sample text' + '</textarea><input type="button" value="Save Edits" id="btnSaveEdits" style="margin-left: 300px;" onclick="HideTextArea(event);"/><input type="button" value="Cancel Edits" id="btnCancelEdits" style="margin-left: 5px;" onclick="DoCleanUp();"/>';
$('#divEditable2').fancybox({
'modal' : true,
'type' : 'inline',
'autoDimensions': false,
'width': '700',
'height': '320',
'showCloseButton': false,
'hideOnOverlayClick': false,
'enableEscapeButton': false,
'content': editorContent
});
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div style="display: none;">
<div id="divEditable2">
This is the test div.</div>
</div>
<input type="button" id="btn" value="show" />
</form>
</body>
</html>
在点击按钮,没有错误(萤火虫),但我仍然不明白为什么的fancybox不出现???我想要的是,在花哨盒内展示一个div。必须有真正的东西 - 真的很愚蠢,我错过了,但只是无法弄清楚自己。谢谢。
谢谢你......我知道我错过了一些非常愚蠢的东西。你的第一条线显示了正确的道路。 – MrClan 2012-01-27 10:13:02