Advertisement

10.09.2008 at 04:13PM PDT, ID: 23802821 | Points: 250
[x]
Attachment Details

Why does document.body.innerHTML = document.body.innerHTML.replace(input,output) cause some of my links to stop working in Firefox but not in Internet Explorer?

Asked by dkcc in Programming for ASP.NET, Internet Explorer Web Browser, Firefox Web Browser

I have an ASPX page that uses
    document.body.innerHTML = document.body.innerHTML.replace(input,output)
to remove a phone number and some other text from the page under certain conditions. It works fine for Internet Explorer and the display is also fine in Firefox, but some links stop functioning on my page in Firefox although they still function normally in Internet Explorer.

Curiously, when I use View Source to look at the page source after removing the phone number from the page I still see the phone number in the source although it doesn't display on the web page. Can you explain why that is and why some of the links on my page stop working after i use document.body.innerHTML = document.body.innerHTML.replace(input,output)
to remove a phone number text string from the page?

I am using .NET Framework 1.1Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
<HEAD>
<script language="javascript1.2" type="text/javascript">
function rmPhoneNumberforCondition()
{
   if(condition==true){
	input = '1-866-123-4567.';
	output='' ;
	document.body.innerHTML = document.body.innerHTML.replace(input,output);
    }
}
</script>
</HEAD>
<body onload="rmPhoneNumberforCondition()">
[+][-]10.09.2008 at 09:36PM PDT, ID: 22684373

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.18.2008 at 07:28PM PST, ID: 22991252

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 14-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-43 / EE_QW_2_20070628