gpt4 book ai didi

javascript - 为什么这个 jquery 窗口不工作?

转载 作者:行者123 更新时间:2023-12-02 20:14:31 25 4
gpt4 key购买 nike

我正在尝试让它运行:http://fstoke.me/jquery/window/ (具体示例 2)

我的代码:

<html>

<head>
<title>Example of Windows</title>
<link rel="stylesheet" type="text/css" href="window.css" />
<script type="text/javascript" src="jquery.js"> </script>
<script type="text/javascript" src="window.js"> </script>
</head>

<body>
<script type='text/javascript'>
$.window({
showModal: true,
modalOpacity: 0.5,
icon: "http://www.fstoke.me/favicon.ico",
title: "Professional JavaScript for Web Developers",
content: $("#window_block2").html(), // load window_block2 html content
footerContent: "<img style="vertical-align:middle;" src="img/star.png"> This is a nice plugin :^)";
});
</script>


<div id="example2" class='example_block'>
<h3>Demo</h3>
<div class='demo'>
<div id='window_block2' style='display:none;'>
<div style='padding:10px;'>
<div style='font-size:24px; font-weight:bold; margin-bottom:10px; color:#44aaff;'>Introduction</div>
<img style='border:0; float:left; margin:10px;' src='http://lh5.ggpht.com/_W-5oCUN3-sQ/TNUfmAY_mFI/AAAAAAAADwc/Dav33v1iBlY/s144/Professional%20JavaScript%20for%20Web%20Developers.jpg'/>
<div>
If you want to achieve JavaScript's full potential, it is critical to understand its nature, history, and limitations.
This book sets the stage by covering JavaScript from its very beginning to the present-day incarnations that include
support for the DOM and Ajax. It also shows you how to extend this powerful language to meet specific needs and create
seamless client-server communication without intermediaries such as Java or hidden frames.
</div>
</div>
</div>
<input type='button' value='Click Here to Create Window' onclick='createWindowWithHtml();'/>
</div>
</div>

</body>

</html>

错误:当我单击按钮时,它没有任何反应!有人看到这里有什么问题吗?我觉得这可能与嵌入脚本有关。

页面现在加载...看起来就像这样,就好像它在加载时触发事件,而不是在单击按钮时触发事件,这里有什么问题吗? img

有人吗?!

最佳答案

如果该文本正是您所拥有的,那么您可能无法执行此操作...

"<img style="vertical-align:middle;" src="img/star.png"> This is a nice plugin :^)";

您很可能需要这个...

footerContent: "<img style='vertical-align:middle;' src='img/star.png'> This is a nice plugin :^)"

最后不需要分号...或者至少不需要

编辑:

function createWindowWithHtml() {
$.window({
showModal: true,
modalOpacity: 0.5,
icon: "http://www.fstoke.me/favicon.ico",
title: "Professional JavaScript for Web Developers",
content: $("#window_block2").html(), // load window_block2 html content
footerContent: "<img style='vertical-align:middle;' src='img/star.png'> This is a nice plugin :^)"
});
}

关于javascript - 为什么这个 jquery 窗口不工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6507813/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com