Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts
Original source
29 responses to “HTML5 Tutorial – 25 – Working with JavaScript in HTML5”
So you saved the .js file in the same folder as the .html file? If we load the html content from a webserver like tomcat or glassfish, where would this js file go. I'm developing an web app in netbeans mainly using html5 and servlets so it'll be very helpful if you reply.
Does anyone know how to trigger a form by clicking on a button?
JavaScript is 40 videos, I just watched it and I didn't expect it to be so close to Java, I didn't learn a thing…
>_
For some reason, it's not working, i am not getting anything when i click first. I checked everything a milion times, i did everything exactly as you did… :/
I thought that all functions had to have parenthesis' when called. For example callFunction(); but I guess not?
YOur videos constraints me to subscribe you! Keep making this amazing videos. Thanks Dude!
After the 10 java script tutorials I was like "Fuck it I know this shit it's just java that was in Chernobyl!" and I understand everything! XD
thug life
Bucky it showing alert onload itself not onclick
javascript's version of a callback function
it wont connect my html to .js i think its because of my .css
Watching HTML tutorials at 1.5x or 2x speed I find pretty cool 🙂
<meta charset="UTF-8">
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="HTML,CSS,XML,JavaScript">
<meta name="author" content="Hege Refsnes"> THE BEST MEATA TAGS
ANYONE WITH DREAMWEAVER;
Awsome! i feel lucky that i find this tutorials.
Ok. Enough for me for now. I'm gonna stop but I'll retake the videos hopefully next month.
As my first time, you've helped me a lot!!
The same id for two elements is bad form. Remember, "Use class to name multiple elements for the same description".
Bucky knows this; he said just a few vids ago yet still makes armature mistake.
HTML has no way to ERROR: nor handle twin ids as that would just break the code and prevent the page from displaying. When parsing the page the second of the twin id will just be over-looked or treated just like a class. Calling an element by id is just a format in design to make sure one specific element is targeted.
Anyhow, good stuff.
So I got my html file saved as Home.html on the desktop
Then I got my javascript file saved as java.js on the desktop aslo.
In the html file i got this code.
<!doctype html>
<html lang ="en">
<head>
<meta charset="utf-8"/>
<script src="java.js">
</script>
</head>
<body>
<div id="big_wrapper">
<p id="tune">first</p>
<p id="bacon">second</p>
<p id="tuna">third</p>
</div>
</body>
</html>
In my Javascript file I have this code
function getStuff() {
document.querySelector('#tune').oncick=talk;
}
function talk(){
alert('hello');
}
window.onLoad=getStuff;
When I run the Html file in google chrome, and try to click "first" nothing happens.
What the heck is going on !!!! Why isn't this working. Please help me this is just getting so frustrating!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! arrrrrrr!!!
this is the ugly Old Style javascript. Nice for beginners though.
why didn't the code work correctly when i directly put the alert function and removed the talk intermediate? like..
function getstuff()
{
document.querySelector('#tuna').onclick=alert("yoyoma!");
}
window.onLoad=getstuff;
"yoyoma" – just another reason why Bucky is probably the coolest teacher in the world
2 elements with the same ID?!? I don't think so! ID's are unique. They can be placed on a single element, while classes are the ones for multiple use.
For some reason I use to think src was SeaRCh not SoRCe
insted of calling for an Alert would this be simular to a method we would use to direct a visitor to another link on our webpage for instance if they were to click on "home" ?
Lol I watched the javascript tutorials like a few days ago 😛
Is there anny reason why my JavaScript wont work?, only simple alerts are working, other complicated stuff is not working
every time u use drop-down menu in notepad++ and say "y am i using drop-down menu"
remember when typing this stuf its case sensitive. like 'getStuff', if you write 'getstuff" in the call out function it won't match
is it supposed to work with firefox?