473,405 Members | 2,421 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,405 software developers and data experts.

How to make a text (with HTML tags )scrolling?

I have this script that scrolls the plain text.

<script type="text/javascript">
var msg = 'My scrolling text. ..';
var myTimeout;
function scrollMsg() {
document.getElementById('textScroll').innerHTML = msg;
msg = msg.substring(1,msg.length) + msg.substring(0,1);
myTimeout = setTimeout(scrollMsg, 200);
}
</script>
How must I change the script so that it will work with HTML text too?.

Thank you any idea.
L.

Nov 17 '06 #1
5 2002
PythonistL wrote:
I have this script that scrolls the plain text.

<script type="text/javascript">
var msg = 'My scrolling text. ..';
var myTimeout;
function scrollMsg() {
document.getElementById('textScroll').innerHTML = msg;
msg = msg.substring(1,msg.length) + msg.substring(0,1);
myTimeout = setTimeout(scrollMsg, 200);
}
</script>
How must I change the script so that it will work with HTML text too?.

Thank you any idea.
L.
Hi

If the element named 'textScroll' is a container (div or span) it is already
working with HTML text.
What is excactly the problem?

Regards,
Erwin Moller
Nov 17 '06 #2

Hello Erwin ,
Thank you for your reply.
So here it is complete my script with HTML. page
##############################
<HTML>
<HEAD>
<TITLE>Scrolling Message Script</TITLE>
<style TYPE="text/css">
#textScroll{
background-color:#F8F8F8;
text-align:center;
font-size: 20px;
font-weight:bold;
}

</style>
<script type="text/javascript">
var msg = ' My scrolling text. <a href="/www.google.com/"><small>Click
here to go to Google</a';
var myTimeout;
function scrollMsg() {
document.getElementById('textScroll').innerHTML = msg;
msg = msg.substring(1,msg.length) + msg.substring(0,1);
myTimeout = setTimeout(scrollMsg, 200);
}
</script>
</HEAD>
<BODY bgcolor="white" onLoad="scrollMsg()">
<div id ="textScroll" onmouseover="if (myTimeout) { clearTimeout(
myTimeout); }" onmouseout="myTimeout = setTimeout(scrollMsg, 200);" >

</div>
</BODY>
</HTML>
##############
It does NOT show properly scrolling text if I use HTML during the time
is works.
It starts well but then it shows HTML tags without coding properly
Where can be a problem?
Thank you for help
Regards,
Lad.

Nov 17 '06 #3
the problem is that your function is stripping the characters one by
one and so when it gets t<a href and the < is stripped, there i sno
longer any valid html in the string.

I know there are plenty of js functions that can do scrolling text, but
any old browser can run this:
<marquee width=55%>
<a href="http://www.google.com/wow">wow scrollingtastic</aHello,
scrolly world
</marquee>

even if you use an xhtml strict served as xhtml/xml,
just use javascript to create a div element and plonk it into the DOM,
that way it will sneak past the validators, and js will still be the
driver.

I mean I know its not a wonderful object oriented solution but at least
its effecient, cross browser, backwards compatible and simple

Nov 17 '06 #4

shimmyshack wrote:
the problem is that your function is stripping the characters one by
one and so when it gets t<a href and the < is stripped, there i sno
longer any valid html in the string.

I know there are plenty of js functions that can do scrolling text, but
any old browser can run this:
<marquee width=55%>
<a href="http://www.google.com/wow">wow scrollingtastic</aHello,
scrolly world
</marquee>
Thank you for your idea. Yes, it works, but how can I stop scrolling
when I put a mouse cursor over the scrolling text ?
And restart again when I move cursor from the text?

Thank you for reply
Lad

Nov 17 '06 #5

PythonistL wrote:
shimmyshack wrote:
the problem is that your function is stripping the characters one by
one and so when it gets t<a href and the < is stripped, there i sno
longer any valid html in the string.

I know there are plenty of js functions that can do scrolling text, but
any old browser can run this:
<marquee width=55%>
<a href="http://www.google.com/wow">wow scrollingtastic</aHello,
scrolly world
</marquee>

Thank you for your idea. Yes, it works, but how can I stop scrolling
when I put a mouse cursor over the scrolling text ?
And restart again when I move cursor from the text?
Can you post your current code?

Peter

Nov 17 '06 #6

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

Similar topics

2
by: SK | last post by:
Is there a way to store HTML into a MySQL TEXT column, yet be able to search over textual content only? For example, if I store the following HTML snippet: <p>A very <em>small</em>...
14
by: Christopher Subich | last post by:
As a hobby project, I'm writing a MUD client -- this scratches an itch, and is also a good excuse to become familiar with the Python language. I have a conceptual handle on most of the...
2
by: BoodieMan | last post by:
The second example doesnt show any borders between frames, but isn't complaiant with the WC3. The top one is compliant but shows the borders. I'd like to get the complaint one to not show any...
2
by: Paul | last post by:
I have a simple frame-based application where title information appears in a top frame and a lower frame contains the content for the application. One of the needs for this app is for a status...
16
by: laura | last post by:
Can anyone help me to decide the best way to do this please. I'm writing an intranet and I need to put something like a non-editable scrolling text box on the home page where daily announcements...
5
by: Will Gillen | last post by:
I need to have a "scrolling" text label or textbox at the bottom of my window to show the URL of where a song is being played from. I want the text to scroll on a single line from left to right in...
1
by: Max Power | last post by:
HTML reprocessor: how do you get rid of the obese MS-Word (normal or filtered) HTML? I just want all the fancy MS tags removed and replaced with basic ones, or if applicable -- stripped entirely...
5
by: PythonistL | last post by:
I am a newbie with Javascript. I have this simple script for scrolling text <HTML> <HEAD> <TITLE>Scrolling Message Script</TITLE> <SCRIPT language="JavaScript"><!-- var msg = 'My scrolling...
3
by: lolo | last post by:
hello. happy new year. I'm trying to build a website for my wife and she is adament on having a horizontal thumbnail scrolling div. great. I have a good vertical scrolling thing, but can't...
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: 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
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.