I'm trying to make a paper.js example but my problem is that I don't know how to make it work without <script type="text/paperscript" canvas="canvas-1">. The script works but I would like to put the js separate to html.
jsFiddle
Thank you
You can use external js file as
<script type="text/paperscript" src="js/script.js" canvas="canvas-1">.
Related
I have simple app with index.html, style.css and app.js and
i need to built a myBundle.js for easy implemantation in other site like:
<script type="text/javascript" src="myBundle.js"></script>
is that posible ?
That's not a good idea, but maybe you can create elements in js and then use append() method to put your HTML / CSS
You can bundle it all inside the HTML file if you'd like. That would be the easiest way to make it portable
So for example:
yourfile.html
<html>
<head>
<style type="text/css">
/* your CSS */
</style>
<script type="text/js">
// your JS code
</script>
</head>
<body></body>
</html>
Then you can move the file anywhere and it will work independently.
As mentioned below this is not a clean way to code but it will work and is useful in some instances
I thought it`s as simple as HTML to include multiple external scripts in SVG.
But false ...
<script type="text/javascript" xlink:href="js/First_Script.js"/>
<script type="text/javascript" xlink:href="js/Second_Script.js"/>
doing like this, none of the scripts will work.
It's not possible for me to include the content of the second script into the first, because the first will be automatically rewritten by a function in an external program.
any suggestion?
Cheers ... Peedy
use <script></script> instead of <script/>. this is a known issue with script tag and svg.
I downloaded the code from codepen.io and it does not work locally.
http://codepen.io/nanarth/pen/raarXe
I suspect that references to some libraries are not exported, but can figure out which.
Can anyone help me with this (I am new to this)
Thank you
UPDATE: Added the following code. Still not working
<head>
<meta charset="utf-8">
<title>Floor Plan - local coordinate map layers for D3.js</title>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.13/d3.min.js"></script>
<script type="text/javascript" src="http://codepen.io/nanarth/pen/yyyqdL"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
Update #2: The screenshot of the error I am getting.
You're right, this pen is including external JS libs. Here's quick gif How to get there.
Those errors You got mean that jQuery libraries are not defined by the time that code runs. Ensure that:
You have copied JS code from the right pane in codepen
You have copied inline JS code from the left (html) pane in codepen
You wrap javascript in jQuery ready function
So what happens, is when then files are exported, one of the files is for some reason empty.
replacing
<script src='js/yyyqdl.js'></script>
with
<script src='http://codepen.io/nanarth/pen/yyyqdL.js'></script>
solved the issue.
Or the file can be downloaded and used locally and keep the old reference
like this:
style="text/javascript"
src="http://helplogger.googlecode.com/svn/trunk/recent-posts-with-titles-only.js"
Please help me>.......
I think this is what your trying to do, the same as you appen any JS library
<script type="text/javascript" src="http://helplogger.googlecode.com/svn/trunk/recent-posts-with-titles-only.js">
You could use <script> html's tag for that.
use:
<script src="myscripts.js"></script>
whenever the script is relative to your webpage
and use:
<script src="http://www.example.com/example.js"></script>
whenever the script is external to your webpage.
This kind of things are well documented on this webpage.
i.e. :
You could see a complet definition of how <script> tag works here.
I'm very new to the HTML5 world and I could use some help with how to use this javascript file.
jquery.autoanchors-0.3
It is found here. http://fredibach.ch/jquery-plugins/autoanchors.php
How do I do use this? How can I include this in the html file in the and the js file how will it automatically add the anchors/links to the html file?
<script src="js/jquery.autoanchors-0.3.js"></script>
Any help would be great.
Thanks
damon
as sachleen points out you'll need jQuery first.
Download jQuery (http://jquery.com/download/)
Include both jQuery and autoanchors into the head of your html file
Follow the instructions on the autoanchors page (http://fredibach.ch/jquery-plugins/autoanchors.php#usage)
Add this to the head section of your webpage, which will add jQuery to your page:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" /></script>
Download the Autoanchors.js file and add it to your site (put it in a folder named js):
<script type="text/javascript" src="js/jquery.autoanchors-0.3.js"></script>
Then follow the instructions on that site under "usage" which would look like this (this goes in the head, right under the line above):
<script>
$(document).ready(function(){
$("div.demo").autoAnchors();
});
</script>