Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

I AM NOT GOOD WITH COMPUTER

Name: Anonymous 2009-03-12 20:32

sup /prog/

I hate to interrupt your threads of trolling and nerdery but I need your help in the simple language of javascript for a greasemonkey script.

I have a script that retrieves certain elements (let's say the URLs of hyperlinks on a page) and a script that creates a text area on the same page.

How do I get the script to dump its contents (the URLs of the hyperlinks or whatever element I had it retrieve) into the textarea that I created on the same page?

Name: Anonymous 2009-03-13 20:43

Using innerHTML is unacceptable. You must use Document Object Model to populate the textarea in an enterprise standards-compliant fashion:

var links = ["http://www.hamstersex.com/", "http://dis.4chan.org/"];
var textarea= document.createElement("textarea");
for (i in links) {
  var link = document.createTextNode(i);
  textarea.appendChild(text);

  var bur = document.createElement("br");
  textarea.appendChild(bur);
}
document.body.insertBefore(textarea, document.body.lastChild)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List