JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 20th, 2001, 05:56 AM
A.Fuss A.Fuss is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 1 A.Fuss User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question

Hi,

I want to scroll some text in a layer. I have done it with Netscape and it wprorks fine, but the IE makes some trouble.

Here is the code I have written. If somebody can help me, please write back.

Tank's

A. Fuss

Code:
-----
<HTML>
...
<script language="JavaScript">
...
function Scrol(delay) {
if (document.all["MA"].document.all["MA2"]style.top == document.all["MA"].style.height)
document.all["MA"].document.all["MA2"]style.top = 0;
document.all["MA"].document.all["MA2"]style.top += 1;
var TimeID = setTimeout(Scrol, delay, delay);
}
...
</script>
...
<body bgcolor="#ffffff" text="#000000" id=all>
<DIV ID="MA" STYLE="position: absolute; left: 100px;
top: 40px; width: 300px; height: 100px; z-index: 9;
visibility: visible;">
<DIV ID="MA2" STYLE="position: absolute; left: 0px;
top: 0px; width: 300px; height: 100px; z-index: 9;
visibility: inherit;">
Hello
</DIV>
</DIV>

<body bgcolor="#ffffff" text="#000000" id=all>
</HTML>


Reply With Quote
  #2  
Old March 20th, 2001, 01:05 PM
JohnB JohnB is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2001
Location: UK
Posts: 527 JohnB User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
I think the top property is returned as a string for Internet Explorer and Netscape 6.
That is it will return (say) "100px" if you read the top property.
Use parseInt to extract the numerical part.

Try changing:

document.all["MA"].document.all["MA2"]style.top += 1;

to:

document.all["MA"].document.all["MA2"]style.top = parseInt(document.all["MA"].document.all["MA2"]style.top) + 1 +"px";

I haven't checked it but this is my "hunch"


John

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > IE - DHTML - scroll question

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap