Tropilac Tropilac - 29 days ago 10
HTML Question

Can I document.write from a url?

I'm wanting to have a message on every page that I can change with ease. I'm very new to JS but have worked with HTML and CSS for over 3 years now.

This is what I've got so far.

<script>document.write(url="/message.html");


The purpose of this is almost like an iFrame. I want a message on every page that I can change with ease. I want to use JS because it is only one line of code I want to print.

<p>NEW!!! - GO CLICK <a href="#">HERE</a> FOR DETAILS</p>


It would be very annoying and difficult to change this single line of code on 30 or so different pages. I would like to have a single file (message.html) and have that displayed.

More info...

Thank you in advance.

Answer

I discovered that I can create a single line of script code that will run a .js file.

<script type="text/javascript" src="message.js"></script>

'message.js'

document.write("<p>This is my message.</p>");

Works well and does exactly what I wanted to do. Thank you to all who helped.