如何使用jsfiddle在我的本地主机

How to use jsfiddle in my localhost

本文关键字:主机 我的 何使用 jsfiddle      更新时间:2023-09-26

这是jsfiddle http://jsfiddle.net/WHzKp/14/.

这是我的html文件:

<!DOCTYPE html>
<html>
<head>
 <script src="http://www.jacklmoore.com/colorbox/jquery.colorbox.js" type="text/javascript" ></script>
    <link rel="stylesheet" href="http://www.jacklmoore.com/colorbox/example4/colorbox.css" type="text/css" media="screen"/>
<script type="text/javascript">
$(document).ready(function () {
    $("#test").click(function () { //on clicking the link above
        $(this).colorbox({iframe:true, width:"100%", height:"100%"});
    });
});
</script>
</head>
<body>
<h3>External Form</h3>
<a href="https://dev88.wufoo.com/forms/ze7xusq0j2tum9/" id="test">Please fill out my form.</a>
</body>
</html>

这里在jsfiddle它的工作很好,我需要什么,但在我的本地主机运行与我的html文件没有工作,谁能指导我,请,我的错误是什么?

你需要修改你的html来包含jquery,因为它将在客户端浏览器中运行,下面我使用了cdn路径到jquery,它应该在jquery.colorbox.js之前加载

<!DOCTYPE html>
<html>
<head>
 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
 <script src="http://www.jacklmoore.com/colorbox/jquery.colorbox.js" type="text/javascript" ></script>
    <link rel="stylesheet" href="http://www.jacklmoore.com/colorbox/example4/colorbox.css" type="text/css" media="screen"/>
<script type="text/javascript">
$(document).ready(function () {
    $("#test").click(function () { //on clicking the link above
        $(this).colorbox({iframe:true, width:"100%", height:"100%"});
    });
});
</script>
</head>
<body>
<h3>External Form</h3>
<a href="https://dev88.wufoo.com/forms/ze7xusq0j2tum9/" id="test">Please fill out my form.</a>
</body>
</html>