Results 1 to 4 of 4

Thread: Always-on-top script not showing in IE 7+IE 8+Opera

  1. #1
    Join Date
    Apr 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Always-on-top script not showing in IE 7+IE 8+Opera

    1) Script Title: Always-on-top

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex10/topmsg.htm

    3) Describe problem:

    I have used this script to enhance a client's promotion and it is included in a Rapidweaver website (I know it's Mac! but this shouldn't be the problem) and it works fine in FF and Safari but absolutely nothing happens in IE 8 and 7 and Opera.

    I have tried so many possibilities that I cannot figure why is isn't working and need your help !

    I know the script shouldn't be in any other HTML etc. but how come it is working in FF and Opera then ?

    Thank you so much

    See the client's page : http://www.o-ceane.ch

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I don't see code for the Always-on-top message script on that page. If it is there, it's missing the required script credit.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Apr 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello,

    Sorry I had to remove the page quickly this morning because the client didn't want it this way (partly working etc.)

    For you to see, I have moved it to : http://www.o-ceane.ch/soinscript/soinscript.html

    Thank you again

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Use this updated version:

    Code:
    var message='<b><font color=#eb7f25 size=4>Nos <a href="assets/oceane_pub_avril_2010_web.jpg">promotions</a> en un clic !</font></b>'
    
    //enter a color name or hex to be used as the background color of the message
    var backgroundcolor="#FFF"
    
    //enter 1 for always display, 2 for ONCE per browser session
    var displaymode=1
    
    //Set duration message should appear on screen, in seconds (10000=10 sec, 0=perpetual)
    var displayduration=0
    
    //enter 0 for non-flashing message, 1 for flashing
    var flashmode=1
    //if above is set to flashing, enter the flash-to color below
    var flashtocolor="#ffcc66"
    
    
    ///////////////do not edit below this line////////////////////////////////////////
    var ie=document.all
    var ieNOTopera=document.all&&navigator.userAgent.indexOf("Opera")==-1
    
    function regenerate(){
    window.location.reload()
    }
    
    function regenerate2(){
    if (document.layers)
    setTimeout("window.onresize=regenerate",400)
    }
    
    var which=0
    
    function flash(){
    if (which==0){
    if (document.layers)
    topmsg_obj.bgColor=flashtocolor
    else
    topmsg_obj.style.backgroundColor=flashtocolor
    which=1
    }
    else{
    if (document.layers)
    topmsg_obj.bgColor=backgroundcolor
    else
    topmsg_obj.style.backgroundColor=backgroundcolor
    which=0
    }
    }
    
    if (ie||document.getElementById)
    document.write('<div id="topmsg" style="position:absolute;visibility:hidden">'+message+'</div>')
    
    var topmsg_obj=ie? document.all.topmsg : document.getElementById? document.getElementById("topmsg") : document.topmsg
    
    function positionit(){
    var dsocleft=ie? document.documentElement.scrollLeft : pageXOffset
    var dsoctop=ie? document.documentElement.scrollTop : pageYOffset
    var window_width=ieNOTopera? document.documentElement.clientWidth : window.innerWidth-20
    var window_height=ieNOTopera? document.documentElement.clientHeight : window.innerHeight
    
    if (ie||document.getElementById){
    topmsg_obj.style.left=parseInt(dsocleft)+window_width/2-topmsg_obj.offsetWidth/2+'px'
    topmsg_obj.style.top=parseInt(dsoctop)+parseInt(window_height)-topmsg_obj.offsetHeight-4+'px'
    }
    else if (document.layers){
    topmsg_obj.left=dsocleft+window_width/2-topmsg_obj.document.width/2
    topmsg_obj.top=dsoctop+window_height-topmsg_obj.document.height-5
    }
    }
    
    function setmessage(){
    if (displaymode==2&&(!display_msg_or_not()))
    return
    if (document.layers){
    topmsg_obj=new Layer(window.innerWidth)
    topmsg_obj.bgColor=backgroundcolor
    regenerate2()
    topmsg_obj.document.write(message)
    topmsg_obj.document.close()
    positionit()
    topmsg_obj.visibility="show"
    if (displayduration!=0)
    setTimeout("topmsg_obj.visibility='hide'",displayduration)
    }
    else{
    positionit()
    topmsg_obj.style.backgroundColor=backgroundcolor
    topmsg_obj.style.visibility="visible"
    if (displayduration!=0)
    setTimeout("topmsg_obj.style.visibility='hidden'",displayduration)
    }
    setInterval("positionit()",100)
    if (flashmode==1)
    setInterval("flash()",1000)
    }
    
    function get_cookie(Name) {
    var search = Name + "="
    var returnvalue = ""
    if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) {
    offset += search.length
    end = document.cookie.indexOf(";", offset)
    if (end == -1)
    end = document.cookie.length;
    returnvalue=unescape(document.cookie.substring(offset, end))
    }
    }
    return returnvalue;
    }
    
    function display_msg_or_not(){
    if (get_cookie("displaymsg")==""){
    document.cookie="displaymsg=yes"
    return true
    }
    else
    return false
    }
    
    if (window.addEventListener){
    	window.addEventListener('load', setmessage, false);
    }
    else if (window.attachEvent){
    	window.attachEvent('onload', setmessage);
    }
    And place it's tag as the last thing before the </body> tag.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •