Show floating layer once

Discussion in 'JavaScript' started by rwtlover, Jul 13, 2006.

  1. #1
    I have a javascript floating layer that I wan't to show once to the users....
    How can I do that?
     
    rwtlover, Jul 13, 2006 IP
  2. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #2
    mad4, Jul 13, 2006 IP
  3. rwtlover

    rwtlover Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    but this is for popups.... how do I add this for a floating layer?$

    Here is the code of my FL:
    <script language="JavaScript1.2">
    isIE=document.all;
    isNN=!document.all&&document.getElementById;
    isN4=document.layers;
    isActive=false;
    
    function MoveInit(e){
      topOne=isIE ? "BODY" : "HTML";
      whichOne=isIE ? document.all.FloatingLayer : document.getElementById("FloatingLayer");  
      ActiveOne=isIE ? event.srcElement : e.target;  
      while (ActiveOne.id!="titleBar"&&ActiveOne.tagName!=topOne){
        ActiveOne=isIE ? ActiveOne.parentElement : ActiveOne.parentNode;
      }  
      if (ActiveOne.id=="titleBar"){
        offsetx=isIE ? event.clientX : e.clientX;
        offsety=isIE ? event.clientY : e.clientY;
        nowX=parseInt(whichOne.style.left);
        nowY=parseInt(whichOne.style.top);
        MoveEnabled=true;
        document.onmousemove=Move;
      }
    }
    
    function Move(e){
      if (!MoveEnabled) return;
      whichOne.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
      whichOne.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
      return false;  
    }
    
    function MoveN4(whatOne){
      if (!isN4) return;
      N4=eval(whatOne);
      N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
      N4.onmousedown=function(e){
        N4.captureEvents(Event.MOUSEMOVE);
        N4x=e.x;
        N4y=e.y;
      }
      N4.onmousemove=function(e){
        if (isActive){
          N4.moveBy(e.x-N4x,e.y-N4y);
          return false;
        }
      }
      N4.onmouseup=function(){
        N4.releaseEvents(Event.MOUSEMOVE);
      }
    }
    
    function ToggleFloatingLayer(DivID, iState) // 1 visible, 0 hidden
    {
        if(document.layers)	   //NN4+
        {
           document.layers[DivID].visibility = iState ? "show" : "hide";
        }
        else if(document.getElementById)	  //gecko(NN6) + IE 5+
        {
            var obj = document.getElementById(DivID);
            obj.style.visibility = iState ? "visible" : "hidden";
        }
        else if(document.all)	// IE 4
        {
            document.all[DivID].style.visibility = iState ? "visible" : "hidden";
        }
    }
    
    document.onmousedown=MoveInit;
    document.onmouseup=Function("MoveEnabled=false");
    </script>
    Code (markup):
     
    rwtlover, Jul 13, 2006 IP
  4. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #4
    There is an example here.

    Alternatively replace the text window.open(page, "", windowprops); in the script I posted first with your_popup_function();
     
    mad4, Jul 13, 2006 IP
  5. rwtlover

    rwtlover Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I'm sorry, I'm realy not good at programming and don't understand what youre trying to explain.
     
    rwtlover, Jul 13, 2006 IP
  6. rwtlover

    rwtlover Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Ok, I guess I'll have to find another explication
     
    rwtlover, Jul 15, 2006 IP