Skip to content

DOM notes

Lauren McCarthy edited this page · 3 revisions

Current DOM API documentation

(more or less)

Current DOM issues open

Other HTML elements to address

(From @shiffman) I'm working on several examples for ITP's "Creative JavaScript" class where I'm having to break into the Document object directly.

Links?

var link = createLink("blah blah");
// <a href="#">blah blah</a>

// an event for when the link is clicked
button.mousePressed(clicky);

var clicky = function() {};

Buttons?

var button = createButton("blah blah");
// <button type="button">blah blah</button>

// an event for when the button is clicked
button.mousePressed(clicky);

var clicky = function() {};

Input elements?

var input = createInput(TEXT,"age");
// <input type="text" name="age"></input>

input.text("Enter your age here");

// An event for when the user types into the text field?
input.keyPressed(typing);

var typing = function() {};

var s = input.getInput(); // what the user has entered

or

var input = createTextInput("age");
var range = createInput(RANGE,"size",10,100);
//<input type="range" name="size" min="10" max="100">

range.moved(itmoved);  // an event for when the user changes the slider?

var itmoved = function() {};

var val = range.getValue(); // the current value of the slider

or

var range = createRange("size",10,100);
Something went wrong with that request. Please try again.