Main content
Computer programming
Course: Computer programming > Unit 6
Lesson 1: Get ready to make your webpages interactiveWelcome to making webpages interactive
Want to join the conversation?
- Why doesn't all JS functions work for me in a webpage?(13 votes)
- It may not completely work because of trying not to let people copyright other program online in the browsers.(8 votes)
- How do i get to add JS + ProcessingJS to my webpage(5 votes)
- i know very little about coding. Will this course help me learn the ropes?(3 votes)
- If you do not know the Java Script necessary make interactive webpages try the Intro to Java Script course on Khan Academy.(7 votes)
- I don't really know where else to ask this question, so I'll just do so here.
I've been working on a webpage that the user can input text into, using acontenteditable
div
. What I would like it to do is center the highlighted text when the user clicks a button.
I already have the button andaddEventListener
in place, but the problem is that it will not center the text. I tried using the.style.textAlign = "center"
method, but it failed to work. I tried creating a<p>
tag around the text, then giving it aclassName
to change thetext-align
of, but this also failed to work.
So in short, what I am looking for is a piece of JS code that demonstrates how to center selected text when a button is clicked. I cannot think what to try next, so any help is appreciated.(5 votes) - how did they come up with the name javascript(3 votes)
- JavaScript started out as Mocha, then became LiveScript and then became JavaScript when Netscape and Sun got together. It was all within six months from May till December (1995) that it was Mocha and then LiveScript. And then in early December, Netscape and Sun did a license agreement and it became JavaScript. And the idea was to make it a complementary scripting language to go with Java, with the compiled language. JavaScript isn't actually an open name. it used to be a trademark of Sun now it's a trademark of Oracle.(4 votes)
- Where can you find the hot list.1:48(3 votes)
- Go to Subjects, than go to computer programing.... Than to the hot list!
I hope this helps! :)(2 votes)
- Atyou said you could use js to controll robots. what is jonny5, and could you teach it on khan academy? 0:58(2 votes)
- http://johnny-five.io/
A single google search would have answered this.(3 votes)
- Do I have to finish HTML/CSS and Javascript to do this?(2 votes)
- While you don't absolutely have to finish them, finishing at least HTML/CSS will make it much easier to understand. And far less frustrating.(2 votes)
- can u make a computer in khan with it or is it more advanced then this(2 votes)
- There were framesets in previous versions of html. How can we put it now(2 votes)
- Use
<iframe>
instead. Learn more here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
Note:<iframe>
is disabled inside the Khan Academy HTML editor.(2 votes)
Video transcript
In this course, you're going to learn
how to make your webpages interactive. You'll start with simple
HTML/CSS webpages, then add JavaScript to change them: like to make a word game, a slide show, an infinitely-loading gallery,
or a drawing app. You can make pretty much
anything you've seen on the web. We'll be using the language
JavaScript to do all of that. And you might be confused if you've learned JavaScript already
and used it in a different way. You see, JavaScript was originally
designed to be shipped with browsers to make webpages interactive. But nowadays you can use JavaScript
in so many different environments: you can use it to power
the back end of servers that render webpages
and store user data, or to write image manipulation scripts, or to process data in a spreadsheet, or even to control robots. If you learned JavaScript
here on Khan Academy, then you learned it in the
ProcessingJS environment to make drawings and animations. If you learned it somewhere else,
like on Codecademy, then maybe you learned it with a
simple command line environment. Each environment comes with its own
set of functionality and global variables. For example, in ProcessingJS,
there are many functions just for drawing an animation, like fill, ellipse,
mouseClicked, and text. In a webpage environment, browsers provide a set of functions
for making webpages interactive, like getElementById, setInterval,
and AddEventListener. You'll learn all about those functions
-- and more -- in this course, and be able to use them
on your webpages to turn them into amazing
interactive experiences.