473,386 Members | 1,741 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,386 software developers and data experts.

Handle &

dmjpro
2,476 2GB
Here is my code ...

Expand|Select|Wrap|Line Numbers
  1. <td onclick="alert(this.innerHTML);">Debasis &amp; Jana</td>
  2.  
When it alerts then it prints Debasis &amp; Jana, if my innerHTML is Debasis & Jana then it still prints the same.
Please Help!
Aug 18 '08 #1
6 1529
acoder
16,027 Expert Mod 8TB
Use textContent for standards-compliance (Firefox/Opera) and innerText for IE.

An alternative is to use firstChild.data or firstChild.nodeValue.
Aug 18 '08 #2
vee10
141 100+
Thanks for the solution
Aug 18 '08 #3
acoder
16,027 Expert Mod 8TB
No problem. Were you looking for the same solution or are you dmjpro in disguise? :p
Aug 18 '08 #4
vee10
141 100+
Hi
In my project i faced the same situation not only for & then i don't know this soln so i have written my own code for displaying & so by seeing this soln now i understood that i have to dig more in to the concepts


No problem. Were you looking for the same solution or are you dmjpro in disguise? :p
Aug 18 '08 #5
dmjpro
2,476 2GB
Use textContent for standards-compliance (Firefox/Opera) and innerText for IE.

An alternative is to use firstChild.data or firstChild.nodeValue.
Thanks Acoder :-)
Actually i got a problem that's why i could not come :-(
Now, what i tried that ....
Expand|Select|Wrap|Line Numbers
  1. this.innerHTML.replace('&amp;','&')
Still it prints the same. Is not the property innerHTML is String?
The same thing tried with a string...expected result coming :-)
Expand|Select|Wrap|Line Numbers
  1. alert('&amp;'.replace('&amp;','&')) //it prints &
Why? Could you explain Acoder?

lol ............. :-)
Actually I wrote Apersandamp; but it comes as & only ..you know what i mean?
Aug 18 '08 #6
acoder
16,027 Expert Mod 8TB
innerHTML will display HTML, not just text. In your <td>, put a <span> element and see the output.
Aug 18 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: ggg | last post by:
Here's what I'm trying to do. The server serves up XML documents based on what I specify in the GET string. This is on a server I have no control over. There is a lag between the time when I...
3
by: Ing. Branislav Gerzo | last post by:
Hello all, user have in browser address bar this URL: http://localhost/store/CDfilter.asp?catid=3&lngid=3&osid=7&ordertype=desc&orderby=release_date&PerPage=50&PageNum=2 I have on page filter...
27
by: Daniel Vallstrom | last post by:
I'm having problems with inconsistent floating point behavior resulting in e.g. assert( x > 0.0 && putchar('\n') && x == 0.0 ); holding. (Actually, my problem is the dual one where I get...
2
by: Mehdi | last post by:
Hi, I need to pass an URL via a hidden value as follow: <input type="hidden" id="Test" runat="Server"> and on Page_Load I assign a value to this hidden input as follow: Test.Value =...
1
by: st | last post by:
Hi, I'm using xmlDocument.Save(xmlTextWriter) to create an Excel-readable file. All works well, except where I've replaced the carriage return chars in the .innertext to XML-compliant " "; It...
4
by: Josh Soref | last post by:
It seems that windows file systems can have files dated to 1617, and unfortunately if you call _findfirst/_findnext on such a directory, msvcr80d will assert. Is there some provision for...
12
by: InvalidLastName | last post by:
We have been used XslTransform. .NET 1.1, for transform XML document, Dataset with xsl to HTML. Some of these html contents contain javascript and links. For example: // javascript if (a &gt; b)...
7
by: John Nagle | last post by:
I've been parsing existing HTML with BeautifulSoup, and occasionally hit content which has something like "Design & Advertising", that is, an "&" instead of an "&amp;". Is there some way I can get...
4
by: Donos | last post by:
Hi I have a HANDLE to an Event, like this.. HANDLE h = ::CreateEvent(NULL, FALSE, FALSE, NULL); This is running in one thread in one class. For example we will call that class as "Class A"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.