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

Mozilla innerHTML unexpected behaviour.....

18
Hi all,
im trying to change the CSS of an HTML element dynamically...for that purpose im taking help of innerHTML property.

i have made the text on which CSS gets applied dynamically, editable, with the help of textarea.

the problem im facing is, maybe mozilla remembers the innerHTML of a textarea on the first posting. So if the user edits the text in textarea, it fails to show new text and shows original text in textarea. In IE it works fine.

wats wrong with innerHTML and mozilla firefox ?

plz advice......
Nov 17 '08 #1
4 1524
theaj
18
the sample code is shown...

[HTML]<html>
<head>
<title></title>
<script type="text/javascript">
function abc()
{
alert(document.getElementById("c").innerHTML);
}
</script>
</head>
<body>
<textarea id="c" onclick="abc()">Its a fact...</textarea>
</body>
</html>
[/HTML]

if i execute this in IE...on click event of textarea...i get alert containing new contents of textarea.....whereas in Mozilla FF, it in any case shows the first contents....need advice...why is it so ?
Nov 17 '08 #2
acoder
16,027 Expert Mod 8TB
Use the value property instead.

Note that you can change the CSS using the elem.style property without messing with innerHTML.
Nov 17 '08 #3
theaj
18
yea but using the value property restricts me from applying inline CSS on selected portion of the text.....actually thats the reason i was more interested in innerHTML.

is there any way to make mozilla aware of the changed innerHTML instead ?
Nov 18 '08 #4
acoder
16,027 Expert Mod 8TB
If that's what you want, then see this (execCommand).
Nov 18 '08 #5

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

Similar topics

4
by: Mitch | last post by:
Here is some code I have bastardised from a few places, Obviously the innerHTML coding won't work in Mozilla, could anyone suggest a work around or fix? cheers, Mitch....
10
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script...
1
by: Ted Weatherly | last post by:
Hello, I want to dynamically create a table cell with a textfield in it. The value for the textfield can have quotes. e.g. I have this snippet of javascript code: var td =...
6
by: Red_Indian | last post by:
Hi How do I accomplish the following functionality in Mozilla/ Firefox: document.form.textbox.disabled = false if I want to conditionally enable a text box that was disabled by default. ...
7
by: KK | last post by:
Please help! I am currently experiencing a bug in Safari v125.9. When I modify the value of form input box and then get the innerHTML property of the surrounding div object - I am returned the...
6
by: hsomob1999 | last post by:
so i have a <ul> and I allow the user to append items to it. The problem is that on mozilla the <span class="line"> which is just a line to divide the sections gets overlaped and doesnt move down...
2
by: Gerhard Esterhuizen | last post by:
Hi, I am observing unexpected behaviour, in the form of a corrupted class member access, from a simple C++ program that accesses an attribute declared in a virtual base class via a chain of...
2
by: ed | last post by:
Hello- i'm having some problems getting innerhtml to clear on mozilla, but it works fine in ie. my page is setup such that i have a div: <div id="otherModel"></div> on a select from a...
8
by: Clément | last post by:
Hi! I am currently developping a user interface with Ajax/C#/.net. And I am facing a problem with Mozilla, and Firefox. I use the function innerHTML to load a Web UserControl into a div, this...
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:
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...
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,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.