Max - Newbee - help display word in html - (probably super easy)
I have a .txt file called maxcode.js that reads as follows:
var chameleon = "blue";
Var Weight = 1;
I have a file called about.html which has the following code in the head section:
In the body section of about.html I have the following code that does not work:
<!-- hide from older browser
What do I need to alter in my code so that the word blue is displayed in the web page per my variable?
Thanks so much
put this script in the head and pls stop flooding the forum with duplicated questions thanks in advance
"I have a .txt file called maxcode.js that reads as follows:"
Why do you say it's a .txt file? If it has the .txt extension on the file, remove it.
Sorry for the duplicate post – as a newbee my first post here took longer to post than normal .
All I’m trying to understand in this post is what code is needed in the body section of about.html to display a variable and in this example the variable chameleon = blue so lets say in the body section of about I want a sentence to read “The bird is blue” if the variable chameleon was red then the sentence would read “The bird is red”. If document.write is not the best code to do this – what is?
Thank You - Max
So the document.write is working? You're just looking for a better way?
A common way is to inject it into the DOM dynamically. Ex:
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread