Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/go/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript HTML集成_Javascript_Html - Fatal编程技术网

Javascript HTML集成

Javascript HTML集成,javascript,html,Javascript,Html,我在浏览这个网站时发现了这个gem:但是我无法构建一个可以运行脚本的有效HTML index.html <!DOCTYPE html> <html lang="en"> <script src="d3.v2.js"></script> <link rel="stylesheet" type="text/css" href="d3portfolio.css" /> &

我在浏览这个网站时发现了这个gem:但是我无法构建一个可以运行脚本的有效HTML

index.html

    <!DOCTYPE html>
    <html lang="en">
        <script src="d3.v2.js"></script>
        <link rel="stylesheet" type="text/css" href="d3portfolio.css" />
            <head>
            <div id="objectives">
                <a href="#agg">Agg</a> 
                <a href="#bal">Bal</a> 
                <a href="#mod">Mod</a> 
                <a href="#inc">Inc</a> 
            </div>
            <div id="d3portfolio"></div>
            <script src="d3portfolio.js"></script>
        </head>
    </html>

其他所有内容都是从中复制/粘贴的

我使用aptana studio,但即使我将其上传到altervista,它也无法工作。我只看到“agg”甜甜圈图表

我的工作区中还有3个其他文件:d3.v2.js、d3portfolio.js和d3portfolio.css

我错过了什么?我试着在业余时间通过反复试验来学习编码


非常感谢

页面中的脚本还将jQuery用于click处理程序,因此您也需要将其包括在内

还可以使用
正文
将页面内容而不是
标题

<!DOCTYPE html>
<html lang="en">
    <head>
        <script src="http://code.jquery.com/jquery-1.11.2.js"></script>
        <script src="http://d3js.org/d3.v2.js"></script>
        <link rel="stylesheet" type="text/css" href="d3portfolio.css" />
    </head>
    <body>
        <div id="objectives">
            <a href="#agg">Agg</a> 
            <a href="#bal">Bal</a> 
            <a href="#mod">Mod</a> 
            <a href="#inc">Inc</a> 
        </div>
        <div id="d3portfolio"></div>
        <script src="d3portfolio.js"></script>
    </body>
</html>
#{
宽度:320px;
高度:320px;
}
.图表标签{
字体:16px无衬线;
填充:#666;
}
.arcLabel{
字体:10px无衬线;
填充:#fff;
}

页面中的脚本还使用jQuery作为单击处理程序,因此您还需要将其包括在内

还可以使用
正文
将页面内容而不是
标题

<!DOCTYPE html>
<html lang="en">
    <head>
        <script src="http://code.jquery.com/jquery-1.11.2.js"></script>
        <script src="http://d3js.org/d3.v2.js"></script>
        <link rel="stylesheet" type="text/css" href="d3portfolio.css" />
    </head>
    <body>
        <div id="objectives">
            <a href="#agg">Agg</a> 
            <a href="#bal">Bal</a> 
            <a href="#mod">Mod</a> 
            <a href="#inc">Inc</a> 
        </div>
        <div id="d3portfolio"></div>
        <script src="d3portfolio.js"></script>
    </body>
</html>
#{
宽度:320px;
高度:320px;
}
.图表标签{
字体:16px无衬线;
填充:#666;
}
.arcLabel{
字体:10px无衬线;
填充:#fff;
}

您需要做的第一件事是在html中包含jquery库。其次,检查你的头部。你已经把内容放进去了。这在html中是不允许的。将其移动到主体部分

<!DOCTYPE html>
<html lang="en">
    <head>
        <script src="http://code.jquery.com/jquery-1.11.2.js"></script>
       //Your other scripts and stylesheets 
    </head>
    <body>
        //Your content.
       //You include scripts at the bottom if you like. 
    </body>
</html>

//您的其他脚本和样式表
//你的内容。
//如果愿意,可以在底部包含脚本。

您需要做的第一件事是在html中包含jquery库。其次,检查你的头部。你已经把内容放进去了。这在html中是不允许的。将其移动到主体部分

<!DOCTYPE html>
<html lang="en">
    <head>
        <script src="http://code.jquery.com/jquery-1.11.2.js"></script>
       //Your other scripts and stylesheets 
    </head>
    <body>
        //Your content.
       //You include scripts at the bottom if you like. 
    </body>
</html>

//您的其他脚本和样式表
//你的内容。
//如果愿意,可以在底部包含脚本。