Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > javascript to change text

javascript to change text
Thread Tools
Mac Enthusiast
Join Date: Nov 2001
Location: Washington, DC 20009
Status: Offline
Reply With Quote
Dec 28, 2002, 09:27 AM
 
I'm looking for a way to use javascript to change a certain block of already-loaded text. I have a main section of my page that contains text and I want that section of text to be updated when someone clicks on a specific link.

Here is what I have so far (mind you I no little about Javascript):

Code:
function rewrite(title, content) { document.all.mainText.innerText = content; document.all.mainTitle.innerText = title; }
This seemed to work with IE, but with Chimera it doesn't.

Could someone give a method that would allow for this to work with all browsers?
Just my $.02 :-)
Ti Powerbook 1Ghz w/ Superdrive ......and lovin' it! :)
     
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Dec 28, 2002, 09:00 PM
 
Originally posted by milf:
I'm looking for a way to use javascript to change a certain block of already-loaded text. I have a main section of my page that contains text and I want that section of text to be updated when someone clicks on a specific link.

Here is what I have so far (mind you I no little about Javascript):

Code:
function rewrite(title, content) { document.all.mainText.innerText = content; document.all.mainTitle.innerText = title; }
This seemed to work with IE, but with Chimera it doesn't.

Could someone give a method that would allow for this to work with all browsers?
All Gecko browsers use a similar DOM, but it varies from that used in the proprietary IE DOM. The 'document.all' container is certainly not the recommended model for all new browsers.

It's been a while since I've used this method and I'm a bit rusty on some of the DOM methods, but http://www.dynamicdrive.com is a great place to start.
Computer thez nohhh...
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:59 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2