#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Posts
    1
    Rep 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>

  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2001
    Location
    UK
    Posts
    527
    Rep Power
    14
    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

IMN logo majestic logo threadwatch logo seochat tools logo