JavaScript in a Codebit...?


#1

Hey guys! I've been working on a roleplay/story game in a Codebit for my family for Christmas, and even if I test out JavaScript on a completely blank page console.log() nor prompt(). Is it that JavaScript is the bones of programming and aren't really shown? Anyway, is there a way I can access the coding on JavaScript via HTML or CSS? Like changing font, color, etc? And vice versa. Can JavaScript reveal 'hidden' (like whited out text) from HTML?

Please help!


#2

Sorry I forgot to add that console.log() and prompt() aren't showing up. That was my main problem.


#3

Try creating HTML tags such as <h1> and then select it with document.getElementByTagName("h1").innerHTML and set it to a variable value:

var myName = prompt("What is your name?");
document.getElementByTagName("h1").innerHTML = myName;

#4

console.log is a debug statement, it's not supposed to be in actual programs, it's just to help the developer see what's going on, and should be left out of the final code,

There are several ways to accomplish what you're thinking, and the best way is to go through the "Make a Website" and "Make an Interactive Website". I'd look into those tools as they can be translated directly to JavaScript files as well.


#5

Yeah you could do that, but my idea is better :wink:

Jk.