473,394 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Replacing text and object required error

Hi, I'm trying to use the following to replace a text string in all the
links on a page:

var arrLinks = document.links;
for(var LinkIterator = 0; LinkIterator < arrLinks.length;
LinkIterator++) {
if(arrLinks[LinkIterator].firstChild.nodeValue == "More
Information"){
arrLinks[LinkIterator].firstChild.nodeValue = "More";
};
};

I'm getting an object required error for this line:

if(arrLinks[LinkIterator].firstChild.nodeValue == "More Information"){

Why is that? Also, I've placed this code near the bottom of the page.
Is this the correct way to do it? Should I be placing it in a function
and calling that? I'm a bit new to this. Thanks for your help.

Nov 25 '05 #1
1 1469
co*****@nelsonford.net wrote:
var arrLinks = document.links;
for(var LinkIterator = 0; LinkIterator < arrLinks.length;
LinkIterator++) {
if(arrLinks[LinkIterator].firstChild.nodeValue == "More
Information"){
arrLinks[LinkIterator].firstChild.nodeValue = "More";
};
};

I'm getting an object required error for this line:

if(arrLinks[LinkIterator].firstChild.nodeValue == "More Information"){

Why is that? Also, I've placed this code near the bottom of the page.
Is this the correct way to do it?


Does `arrLinks' even evaluate to an object reference?
Does `arrLinks[LinkIterator]' etc.?

<http://www.pointedears.de/scripts/test/whatami>, § 2.

Anyway, the above code should be called in the `onload' event handler
attribute value of the document's `body' element to make sure the DOM
tree it is operating on was completely built.
HTH

PointedEars
Nov 25 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: jamesfin | last post by:
Dear XMLers, Please guide me... I have a simple xml file... <URLTest>
6
by: Peter Foti | last post by:
I have seen lots of examples where some HTML text is replaced with a background image using CSS. For example, replacing the text of an <h1> with a graphical logo, like so: CSS: h1 span {...
1
by: IkBenHet | last post by:
Hello, I found this script to create a simple rich text form (http://programmabilities.com/xml/index.php?id=17): <html> <head> <title>Rich Text Editor</title> </head> <body>
31
by: J.S. | last post by:
Let's say I have a text file with parameters like the following embedded in the text: @@Textbox1@@, @@Textbox2@@, etc. Is it possible to replace the parameters in the text file with values...
2
by: Chad | last post by:
In our application, I would like to send out HTML mail. TO do so, I must do something like this: Mail.Body = <raw HTMLTEXT String> Hence, I would like to know how to get the HTML text for Web...
1
by: amraam35 | last post by:
Here is the problem. I have made a log in script that prompts you to log in with a username and password as the "splash screen" It is an unbounded forum that checks that the username and password...
6
by: saif.shakeel | last post by:
Hi, I need to replace a string in xml file with something else.Ex - <SERVICEPARAMETER id="_775" Semantics="subfunction" DDORef="_54"> <SHORTNAME>rate</SHORTNAME> <LONGNAME>rate</LONGNAME>...
0
by: mbenedict | last post by:
I am rather new at this code and am attempting to modify existing code to use clob datatypes, which I have never used before. The database tables have been set up for clob data. When trying to use...
1
by: Manikrag | last post by:
Hi Team, This application is in ASP.Net and C#. I have Global.asax, webconfig and aspx pages on the server with code behind logic in Bin directory as DLLs. I made few changes in code behind on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.