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

Firefox: set innerHTML of Marquee-Tag

Hello,

I want to set the text of a marqee dynamical. So I created the
following code:
****snip****
<style>
#noticeMarquee
{
background-color:#ff00ff;
color:#ffffff;
display:none;
padding: 2px;
font-size:10pt;
}
</style>
<script type="text/javascript">
function showMarquee(text){

var elem = document.getElementById("noticeMarquee");

if(text==""){
elem.style.display = "none";
}
else{
elem.firstChild.innerHTML = text;
elem.style.display = "block";
}
}
</script>
</head>
<body>
<marquee id="noticeMarquee"></marquee>
<div onclick="showMarquee('this is the text')">clickme</div>

***snap***

This works fine in IE, but Firefox does only display the box of the
marquee, not the text I set it to.

I tried it with innerText or adding childnodes and stuff like that. But
it seems like firefox does not update the marquee.

Hopefully someone can help me this this!

Thank you!

Regards,
Uwe Braunholz

May 19 '06 #1
4 11269


uw***********@hotmail.de wrote:

I want to set the text of a marqee dynamical. function showMarquee(text){

var elem = document.getElementById("noticeMarquee");

if(text==""){
elem.style.display = "none";
}
else{
elem.firstChild.innerHTML = text;


Why elem.firstChild.innerHTML, why not elem.innerHTML?

But I am not sure DOM manipulation of marquee works, marquee support in
Mozilla is a hack mostly meant to work for those pages where marquees
are used in markup.

--

Martin Honnen
http://JavaScript.FAQTs.com/
May 19 '06 #2
uw***********@hotmail.de wrote :
Hello,

I want to set the text of a marqee dynamical. So I created the
following code:
****snip****
<style>
#noticeMarquee
{
background-color:#ff00ff;
color:#ffffff;
display:none;
padding: 2px;
font-size:10pt;
Why do you need to use pt? Why not %tage or em? pt is best for print
media, not for screen.

W3C Quality Assurance tip for webmasters:
Care With Font Size: Recommended Practices
http://www.w3.org/QA/Tips/font-size#goodpractice

"Do not specify the font-size in pt, or other absolute length units.
They render inconsistently across platforms and can't be resized by the
User Agent (e.g browser).
Use relative length units such as percent or (better) em"
}
</style>
<script type="text/javascript">
function showMarquee(text){

var elem = document.getElementById("noticeMarquee");

if(text==""){
elem.style.display = "none";
}
else{
elem.firstChild.innerHTML = text;
If you only want to set the text node, then you do not need innerHTML
and you should use
elem.firstChild.nodeValue = text;
If you use innerHTML to change the text node, then you do not need to
refer to the firstChild. Whatever you do, I don't see how or why you
would need to use innerHTML to change the text node.
elem.style.display = "block";
I do not understand the need to toggle the display from none to block
and vice versa if there is a text node or not. It kinda makes no sense
to me.
}
}
</script>
</head>
<body>
<marquee id="noticeMarquee"></marquee>
<div onclick="showMarquee('this is the text')">clickme</div>

***snap***

This works fine in IE, but Firefox does only display the box of the
marquee, not the text I set it to.
You have not provided sufficient amount of code to understand what
you're doing actually in terms of webpage context. Giving an url would
have been helpful.

I tried it with innerText or adding childnodes and stuff like that. But
it seems like firefox does not update the marquee.

innerText is a MSIE-specific DOM attribute not supported by Firefox.
innerText is not a W3C DOM attribute.
Hopefully someone can help me this this!

Thank you!

Regards,
Uwe Braunholz


Complete example with explanations is available here:
DHTML Demonstrations Using DOM/Style:Stock Ticker
http://developer.mozilla.org/en/docs...e:Stock_Ticker

Gérard
--
remove blah to email me
May 20 '06 #3
Uwe
Thank you Martin and Gérard,

i am sorry, if the sample is a bit tiny. But thats what I acctually do:
I want to call the function (showMarquee) from another frame to set a
dynamical-read text to the marquee. This is meant to be some kind of
"notice trigger". Thats why it is display none, if there is no text to
display.

Sorry for my bad sample. I did not remove the firstChild while
preparing my sample. With that I tried to set the text of an innertag.

Unfortunately the nodeValue does not change a thing in Firefox. It
won't display the text anyway.

Perhaps there is another solution (without using a tiker-js).

Thank you!
Uwe

May 23 '06 #4
uw***********@hotmail.de wrote:
<style>
The required `type' attribute is missing:

<style type="text/css">
#noticeMarquee
{
background-color:#ff00ff;
color:#ffffff;
background-color:#f0f; /* or fuchsia */
color:#fff; /* or white */
display:none;
padding: 2px;
font-size:10pt;
`pt' is a unit of length suited for printouts, not for the screen; what is
displayed large enough with your _font_ resolution (Windows default for
1024x786: 96 ppi) may be unreadable or huge for other people. Use `%',
`em' or `px' instead. In that order of preference, because `px' prevents
the text from being scaleable in IE < 7 (a bug).

See also: [de] http://dciwam.de/faq/gute-websites/einheit-pt
}
</style>
<script type="text/javascript">
function showMarquee(text){

var elem = document.getElementById("noticeMarquee");
<URL:http://pointedears.de/scripts/test/whatami#inference>
if(text==""){
elem.style.display = "none";
}
else{
elem.firstChild.innerHTML = text;
`innerHTML' is proprietary, so you are mixing two DOMs here,
which is unwise at best. Firefox supports the `textContent'
property of W3C DOM Level 3 Core, DOM Level 2-conforming UAs
support the nodeValue property of a Node object.

See also: <URL:http://pointedears.de/scripts/dhtml.js>
[...]
<marquee id="noticeMarquee"></marquee>


I go with Martin's assessment. The `marquee' element is proprietary.
It creates invalid HTML, and should not be scripted, or used at all.

<URL:http://validator.w3.org/>
PointedEars

P.S.
de.comp.lang.javascript exists. (If you want to subscribe, please
read news:de-newusers-infos/einleitung/20********@krell.zikzak.de
first.
--
The German psychs, the German authorities, the German secret service agents
are [...] fanatics, they are insane and known of persecuting innocent people
and Scientologists. -- "The only real Barbara Schwarz", dsw.scientology,
<16**************************@posting.google.com >
May 24 '06 #5

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

Similar topics

2
by: Peregrine Maitland | last post by:
I have scrolling news that is based on JavaScript on the site I maintain. The script works in Internet Explorer 6.x, but not Firefox 1.0. It's not clear to me why the script doesn't work with...
14
by: catorcio | last post by:
I'm trying to have some text in my page changed by clicking a button. Googleing around I've discovered that innerText doesn't work with every browser, so I've switched to innerHTML. It works fine...
9
by: Astra | last post by:
Hi everybody Wonder if you could help me out. I created a simple JavaScript routine to enable a user to click backwards and forwards between small news articles. This routine works fine in IE...
5
by: Craig Keightley | last post by:
Please help, i have attached my page which worksin IE but i cannnot get the drop down menu to fucntion in firefox. Any one have any ideas why? Many Thanks Craig ...
4
by: Jake Barnes | last post by:
I wanted to teach myself AJAX this weekend so I sat down with Stuart Landgridge's book and I started to play around. I came up with a little page that you can add text and images to. You can see it...
10
by: Jake Barnes | last post by:
This weekend I wanted to learn AJAX, so I set up a little toy page where I could experiment. The idea of this page is that you click in one of the boxes to get some controls, at which point you can...
2
by: sveinn | last post by:
Hi all, I've read through this group searching for an answear about this problem. Few have come close but not quite what I need. My problem is this: I'm using Ajax to fetch a new table with...
4
by: tcole6 | last post by:
My problem appears to be Firefox specific. I have a hyperlink that loads a new window. This window contains hyperlinks that call javascript functions in the parent window and then closes the...
1
by: raju78.k | last post by:
Hi, I have a problem with FireFox. I have written a function to Add rows without submiting the form. This function works fine in IE, but not in FireFox. The function is : function...
5
by: 000baaa000 | last post by:
The following HTML marquee code works better in Microsoft Internet Explorer, breaks (in more than one way) in Mozzila Firefox <pre>------------------------------------------------- start HTML...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.