Adding updated text website with java script -

They have: 5,633 posts

Joined: Jan 1970

Is there an easy way to use java script to input the text updates into a web page instead of instead of redueing the web page each time.

------------------
Ken Thorson

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

With a JavaScript, it is a little shaky on browser support. If you use tables, it sometimes makes a mess in NS3 if you use a document.write- which you would need for this script. Some other browsers won't support it at all- and with the need to use an external JS the only browsers that will probably see it are IE4+ and NS4+. The best way to do this would be through CGI and/or SSI.

The way to do it with JS involves using an external .js file. You can see how to use this at:
http://www.pageresource.com/jscript/jxtern.htm

In this case, you would make the .js file look something like this:

-----------------------------
function newcontent()
{
document.write("Your new text in Here<BR>");
document.write("other new text, etc.");
}
------------------------------

Then, in your html file, be sure to point to the script in your HEAD section:

<SCRIPT language="JavaScript" SRC="yourname.js"></SCRIPT>

Then, call the script in the body section where you want the new text to show up:

<SCRIPT language="JavaScript">
<--
newcontent();
//-->
</SCRIPT>

------------------
John Pollock
http://www.pageresource.com
http://www.javascriptcity.com

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.