I have a webpage which I am experimenting with, where the user has to have a specific bookmarklet from another one of my sites to continue the game. This bookmarklet adds code to the tag, and enables the user to continue.
The problem is that I am having trouble making the bookmarklet, since I am fairly new at using javascript.
Can anyone help me with this?
Asked
Active
Viewed 2,713 times
-3

Charles Fecht
- 47
- 1
- 9
-
what did you try? what's blocking you? – pataluc Oct 24 '14 at 13:04
-
1If you're new to javascript try to learn it first: https://www.codeschool.com/paths/javascript This might help you. – TheFrozenOne Oct 24 '14 at 13:06
-
@pataluc Not the bookmarklet itself, but rather what inputs the code in the body tag. – Charles Fecht Oct 24 '14 at 13:06
-
I'm confused. Your title appears that you need help with adding the HTML code but your question appears to ask for help with making the bookmarklet. Do you need help with JS to add HTML to the body or how to create a bookmarklet? – mark Oct 24 '14 at 13:09
-
@mark Sorry for the confusion. I need help with JS to add HTML to the body. – Charles Fecht Oct 24 '14 at 13:11
-
@Doodlebunch Thanks for the link, I have not been able to find a website that teaches javascript well. I will try it. – Charles Fecht Oct 24 '14 at 14:56
-
Please do not down vote or add anymore answers, please. This question was from when I had no idea what I was doing. – Charles Fecht Mar 09 '15 at 18:20
1 Answers
2
To add javascript to the body, try this:
var code = '<h1>TEST</h1>';
document.body.innerHTML = code;
You will have to play with it to get what you want to do, but that's the general idea. If you have a particular div
you want to use, try doing the same thing but with document.getElementById

mark
- 183
- 2
- 9