changing already loaded text

wxdqz

New Member
I'm looking to change a block of text using javascript. I'd prefer to use this method as opposed to refreshing the page each time.

I basically want to be able to change the content of a block of text depending on when a visitor clicks a link. The idea is that the visitor can sort navigate through journal entries by clicking on a link. Clicking a link will bring that entry to the main section of the page.

I've seen this done before and I think I had it working on IE, but something still isn't right. Here's what I had:


function rewrite(title, text) {
document.all.mainText.innerText = text;
document.all.mainTitle.innterText = title;
}


I have to <span id="xxx"> tags in the HTML that represent mainText and mainTitle. I read somewhere that document.all is a MS thing and probably won't be supported by all browsers. Is there a workaround to this?

Could someone suggest a better approach. I'm open to suggestions so long as I don't have to refresh the page each time. I'd prefer it to be dynamic.

Thanks!
 
Back
Top