Web Analytics Made Easy -
StatCounter Fly-in text script - CodingForum

Announcement

Collapse
No announcement yet.

Fly-in text script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Fly-in text script

    hey every one, I can't get this fly in text script to work. It says there is an error on line 99.

    Here is the script:

    <html>
    <head>
    <SCRIPT LANGUAGE="JavaScript">
    var isNav, isIE, intervalID
    var coll = ""
    var styleObj = ""
    if (parseInt(navigator.appVersion)>=4) {
    if (navigator.appName == "Netscape") {
    isNav = true
    } else {
    isIE = true
    coll = "all."
    styleObj = ".style"
    }
    }
    //Utility function returns height of object in pixels
    function getObjHeight(obj) {
    if (isNav) {
    return obj.clip.height
    } else {
    return obj.clientHeight
    }
    }
    //Utility function returns width of object in pixels
    function getObjWidth(obj) {
    if (isNav) {
    return obj.client.width
    } else {
    return obj.clientWidth
    }
    }
    //Utility function returns the x coordinate of a positionable object
    function getObjLeft(obj) {
    if (isNav) {
    return obj.left
    } else {
    return obj.pixelLeft
    }
    }
    //Utility function returns the y coordinate of a positionable object
    function getObjTop(obj) {
    if (isNav) {
    return obj.top
    } else {
    return obj.pixelTop
    }
    }
    //Utility function returns the available content width space in borwser window
    function getInsideWindowWidth() {
    if (isNav) {
    return window.innerWidth
    } else {
    return document.body.clientWidth
    }
    }
    //Utility function returns the available content height space in browser window
    function getInsideWidnowHeight() {
    if (isNav) {
    return window.innerHeight
    } else {
    return document.body.clientHeight
    }
    }
    //Utility function sets the object visibility to visible
    function show(obj) {
    obj.visibility = "visible"
    }

    //Utility function sets the object visibility to hidden
    function hide(obj) {
    obj.visibility = "hidden"
    }
    //Utility function positions an element at a specific x, y location
    function shiftTo(obj, x,y) {
    if (isNav) {
    obj.moveTo(x,y)
    } else {
    obj.pixelLeft = x
    obj.pixelTop = y
    }
    }
    //Utility function to move an object by x and/or y pixels
    function shiftBy(obj, deltaX, deltaY) {
    if (isNav) {
    obj.moveBy(deltaX, deltaY)
    } else {
    obj.pixelLeft += deltaX
    obj.pixelTop += deltaY
    }
    }
    //**End library code**
    //Set initial position offscreen and show object and
    //start timer by calling glideToCenter()
    function intro() {
    var obj = eval("document." + coll + "banner" + styleObj)
    var contentObj = eval("document." + coll + "banner")
    shiftTo(obj, getInsideWindowWidth(),
    Math.round((getInsideWindowHeight()/2)-(getObjHeight(contentObj)/2)))
    show(obj)
    glideToCenter()
    }
    //Move the object to the left by 5 pixels until it's centered
    function glideToCenter() {
    var obj = eval("document." + coll + "banner")
    shiftBy(obj,-5,0)
    var a = getObjLeft(obj)
    var b = math.round((getInsideWindowWidth()/2) - (getObjWidth(contentObj)/2))
    if (a<=b) {
    clearTimeout(intervalID)
    } else {
    intervalID = setTimeout("glideToCenter()",1)
    }
    }
    </script>





    <title>Fly-in</title>
    </head>

    <body onLoad="intro()">
    <DIV ID="banner" STYLE="position:absolute; visibility:hidden; left:0; top:0; background-color:blue; width:1; height:1">
    <P ID="txt" STYLE="position:absolute; left:0; top:0; font-size:36pt; color:black">
    Check it out dude, I'm flyin'!!!
    </P>


    </body>
    </html>


    Any ideas??
    ً?ذHط§§?ً

  • #2
    You need to use the Javascript Console in Netscape, then you'd have seen that getInsideWindowHeight was not defined. That should have clued you in to look for that function where you'd have seen that it was mis-spelled as getInsideWidnowHeight .
    Check out the Forum Search. It's the short path to getting great results from this forum.

    Comment


    • #3
      DOH!

      AH! I knew it was something small. Thank you for your input. I shall see how it works now.
      ً?ذHط§§?ً

      Comment

      Working...
      X