Jump to content

This might be impossible....


Kovo

Recommended Posts

Is there a way to use javascript (or other languages) to change live content on a web page? Let me be much more specific.Loo at this code snippet:

<div class="threecolbox_1E87CDB"><img src="images/image_01.jpg" width="172" height="172" style="position: relative; top:0px;" alt="topleft"/><br/><div class="nav1">	<br/><!--#include virtual="left.txt" --></div>				</div>

This is part of a large code here www.kovo.ca/1/homeb.shtmlIs there a way to change the "left.txt" say by clicking a link on the same page?This way I dont have to resort to frames....And of course if it does change the page automatically updates the content

Link to comment
Share on other sites

Change the code you posted to THAT

<div class="threecolbox_1E87CDB"><img src="images/image_01.jpg" width="172" height="172" style="position: relative; top:0px;" alt="topleft"/><br/><div class="nav1">	<br/><div id="conts"><!--#include virtual="left.txt" --></div></div>				</div>

And add this to whatever javascript file you have:

function createRequestObject() {	var ro;	var browser = navigator.appName;	if(browser == "Microsoft Internet Explorer"){		ro = new ActiveXObject("Microsoft.XMLHTTP");	}else{		ro = new XMLHttpRequest();	}	return ro;}var change=createRequestObject();function clicker(filename){change.open('get',filename);change.onreadystatechange = handleFile;change.send(null);}function handleFile(){if(change.readyState ==4){ document.getElementById("conts").innerHTML=change.responseText }}

And also, dont use TXT files, use HTML or PHP pages.(ie save the files as .html or .php or even .htm if you want.

Link to comment
Share on other sites

Change the code you posted to THAT
<div class="threecolbox_1E87CDB"><img src="images/image_01.jpg" width="172" height="172" style="position: relative; top:0px;" alt="topleft"/><br/><div class="nav1">	<br/><div id="conts"><!--#include virtual="left.txt" --></div></div>				</div>

And add this to whatever javascript file you have:

function createRequestObject() {	var ro;	var browser = navigator.appName;	if(browser == "Microsoft Internet Explorer"){		ro = new ActiveXObject("Microsoft.XMLHTTP");	}else{		ro = new XMLHttpRequest();	}	return ro;}var change=createRequestObject();function clicker(filename){change.open('get',filename);change.onreadystatechange = handleFile;change.send(null);}function handleFile(){if(change.readyState ==4){ document.getElementById("conts").innerHTML=change.responseText }}

And also, dont use TXT files, use HTML or PHP pages.(ie save the files as .html or .php or even .htm if you want.

Wow thank you.So say I want someone to click a link on the page, how would I call this script and how would it know what file to go to.Say its left.txt and I want someone to click a link so it changes to right.txt. How would that look? Im a noob at this, and so far youve been a great help to me.
Link to comment
Share on other sites

Wow thank you.So say I want someone to click a link on the page, how would I call this script and how would it know what file to go to.Say its left.txt and I want someone to click a link so it changes to right.txt. How would that look? Im a noob at this, and so far youve been a great help to me.
<a href="java script:clicker('left.txt');">Left.txt</a>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...