473,654 Members | 3,062 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Flying text sinks to the bottom, does not rise to the top?

I write a flying text script,but it sinks at the bottom and it stays
there forever.

How to change it so that it flies in the webpage?

<html>
<head>
<title>Flying text</title>
<script type="text/javascript">
<!--
var dom, finalx=700, finaly=540;
function initText() {
dom=document.ge tElementById("t heText").style;
var x=dom.left;
var y=dom.top;
x=x.match(/\d+/);
y=y.match(/\d+/);
moveText(x,y);
}
function moveText(x,y) {
if(x!=finalx)
if (x>finalx) x--;
else x++;
if(y!=finaly)
if (y>finaly) y--;
else y++;
if( (x!=finalx) || (y!=finaly)) {
dom.left=x+"px" ;
dom.top=y+"px";
}
setTimeout("mov eText(" + x + "," + y + ")", 1);
}
//-->
</script>
</head>
<body onload="initTex t()" >
<p>
<span id="theText" style="position : absolute; left: 100px; top:
100px; font: bold 20pt 'Times Roman'; color: blue;">
Hello!
</span>
</p>
</body>
</html>

Jul 23 '05 #1
1 1761
al********@hotm ail.com <ma*****@hotmai l.com> wrote in message
news:11******** *************@g 14g2000cwa.goog legroups.com...
I write a flying text script,but it sinks at the bottom and it stays
there forever.

How to change it so that it flies in the webpage?


You need to store the current x and y direction, increment the co-ordinates
accordingly and change directions when defined limits are reached.

<html>
<head>
<title>Flying text</title>
<script type="text/javascript">

var dom, finalY=screen.a vailHeight||scr een.height,
finalX=screen.a vailWidth||scre en.width, xDir=1, yDir=1;
finalY=Math.rou nd(finalY*0.7);

function initText()
{
if( document.getEle mentById &&
(dom=document.g etElementById(" theText").style ) )
{
var x=dom.left;
var y=dom.top;
x=x.match(/\d/);
y=y.match(/\d/);
moveText(x,y);
}
}

function moveText(x,y)
{

if( (xDir==1 && x>=finalX) || xDir==-1 && x<=0)
xDir=-xDir;

x+=xDir;

if( (yDir==1 && y>=finalY) || yDir==-1 && y<=0)
yDir=-yDir;

y+=yDir;

dom.left=x+"px" ;
dom.top=y+"px";

setTimeout("mov eText(" + x + "," + y + ")", 50);
}

</script>
</head>

<body onload="initTex t()" >

<div id="theText" style="position : absolute; left: 100px; top:
100px; font: bold 20pt 'Times Roman'; color: blue;">Hello!</div>

</body>
</html>
--
Stephen Chalmers http://makeashorterlink.com/?H3E82245A


Jul 23 '05 #2

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

Similar topics

2
15624
by: zwylle | last post by:
Hi all, to avoid a nervous breakdown I finally decided to seek help :D I have a table defined with plain color background and in some cells I show pictures to frame my site. The problem I have occurs for one special cell. The background of this cell is as you can see an image. A text should be displayed on this image. I don't want the text to be bigger than the picture.
1
1516
by: Serge Shimanovsky | last post by:
Hi, I have a situation where I need to clear the event sinks from an event. But let's say I don't know which methods (by name, I mean) signed up for that event. I do have a control with lets say two events: ItemCheck and DataSourceChange. Callbacks assigned to ItemCheck and DataSourceChange
0
1599
by: Razzie | last post by:
Hey all, I'm... pretty stuck. I've created a ISmtpInCommand sink following this tutorial: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsmtps/html/writingmngsinks.asp I've used the smtpreg.vbs script in step 11 of tutorial to bind this script, or how you call that. All well. But I altered my code to use the IMailTransportSubmission sink. Now I can't
6
3291
by: Bosnewi | last post by:
hi, What's the easiest way to make a text to fly inside of any control such as textbox. Any ideas???
3
2004
by: RobofNZ | last post by:
Hi Guy's, I'm a little new to the .NET enviroment but need to put together a custom sink chain for a mini project I've got.... The problem that I'm having is that the system needs to be more tamper proof than a config file would allow and I'm struggling to find any examples or details on how to build a multi sink chain in code..... Does anyone out there have a simple example piece of code which links
2
2094
by: george.leithead | last post by:
Hi all, I have a very strange problem! In following Web page (which is generated from a CMS System), the navigation to the left 'dissapears' when you roll the mouse over the links? It does not do this in all browsers either. I have found it to happen in IE 7 and the latest patched IE 6. I have tried to find out the reason, but keep finding strange behaviour! You will see at the bottom of the HTML, I have a comment. If you follow...
9
5096
panachepad
by: panachepad | last post by:
I arrived here from a websearch that found this thread from your archives: http://www.thescripts.com/forum/thread97805.html It helped me to understand that I am on the right track, but I still have one problem surrounding this issue. I am trying to make a <div> block that contains a) a link b) an arrow or an image of an arrow c) another link d) another link floated off to the far right All of this must be on one horizontal line. The...
3
5625
by: kk.simhadri | last post by:
Hi, I want to align some text to the bottom of page.I am doing this by a CSS class.It contains position:absolute; bottom:0; this does the purpose. but when I resize my page to smaller size, the text at the bottom overlaps my text written in the page above it.
0
4445
by: JosAH | last post by:
Greetings, Introduction Last week I was a bit too busy to cook up this part of the article series; sorry for that. This article part wraps up the Text Processing article series. The attachment contains the complete source code which was explained in the previous article parts. Download it, extract the sources somewhere and have a look. The data I've been using all the time can be found here. There are
0
8290
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8815
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8707
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7306
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6161
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1593
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.