uprava JS

Programovacie jazyky, rady, poradňa...
simusko
Amateur
Amateur
Príspevky: 13
Registrovaný: 11 júl 2009, 10:04

uprava JS

Príspevok od používateľa simusko »

Zdravim,
zrovna 2x sa v javascriptoch nevyznam, ale chcel by som upravit ten co mam na stranke tak aby sa mi nezobrazoval zlava zdola, ale zprava zhruba niekde v strede. Je to na http://www.jm-design.sk/index.php (Facebook). Samotny script:

Kód: Vybrať všetko

(function (){

  var container, close, content, frame, label;
  var moveBottom, moveInterval;
  
  function init(){
  
    function Get_Cookie(name){
      var start = document.cookie.indexOf( name + "=" );
      var len = start + name.length + 1;
      if ((!start) && (name != document.cookie.substring( 0, name.length ))){
        return null;
      }
      if (start == -1) return null;
      var end = document.cookie.indexOf( ";", len );
      if (end == -1) end = document.cookie.length;
      return unescape( document.cookie.substring( len, end ) );
    }
    
    function Set_Cookie(name, value, expires, path, domain, secure){
      var today = new Date();
      today.setTime(today.getTime());
      if (expires){
        expires = expires * 1000;
      }
      var expires_date = new Date(today.getTime() + (expires));
      document.cookie = name + "=" +escape( value ) +
      ((expires) ? ";expires=" + expires_date.toGMTString() : "" ) +
      ((path) ? ";path=" + path : "" ) +
      ((domain) ? ";domain=" + domain : "" ) +
      ((secure) ? ";secure" : "" );
    }
    
    var ad = parseInt(Get_Cookie("ad"));
    if (ad == 1){
      Set_Cookie("ad", "2", 0);
    }
    if (ad == 2){
      return;
    }
  
    container = document.createElement("DIV");
    frame = document.createElement("DIV");
    close = document.createElement("DIV");
    content = document.createElement("DIV");
    label = document.createElement("SPAN");
    
    container.style.background = "transparent";
    container.style.border = "0 none";
    container.style.bottom = "0px";
    container.style.display = "none";
    container.style.height = "188px";
    container.style.margin = "0";
    container.style.padding = "0";
    container.style.position = "fixed";
    container.style.right = "0px";
    container.style.width = "166px";
    
    frame.style.background = "url('http://www.jm-design.sk/images/window.png') no-repeat";
    frame.style.border = "0 none";
    frame.style.height = "188px";
    frame.style.left = "0";
    frame.style.margin = "0";
    frame.style.opacity = "0.7";
    frame.style.filter = "alpha(opacity=70)";
    frame.style.padding = "0";
    frame.style.position = "absolute";
    frame.style.top = "0px";
    frame.style.width = "166px";
    
    close.style.background = "transparent url('http://www.jm-design.sk/images/close.png') no-repeat 0 0";
    close.style.border = "0 none";
    close.style.cursor = "pointer";
    close.style.height = "17px";
    close.style.position = "absolute";
    close.style.right = "10px";
    close.style.top = "10px";
    close.style.width = "31px";
    
   content.style.background = "black url('http://www.jm-design.sk/images/facebook.png') no-repeat 0 0px";
    content.style.border = "0 none";
    content.style.color = "lime";
    content.style.cursor = "pointer";
    content.style.height = "150px";
    content.style.left = "8px";
    content.style.margin = "0";
    content.style.padding = "0";
    content.style.position = "absolute";
    content.style.top = "30px";
    content.style.width = "150px";
    
 label.style.background = "url('http://www.jm-design.sk/images/bullet.png') no-repeat 0 4px";
    label.style.border = "0 none";
    label.style.color = "#dddddd";
    label.style.paddingLeft = "8px";
    label.style.position = "absolute";
    label.style.left = "10px";
    label.style.top = "8px";
    label.style.font = "normal 14px Arial"
    label.innerHTML = "Podporte nás";
    
    close.onmouseover = function (){
      this.style.backgroundPosition = "0 -17px";
    }
    close.onmouseout = function (){
      this.style.backgroundPosition = "0 0";
    }
    close.onclick = function (){
      Set_Cookie("ad", "2", 600);
      unmoveStart();
    }
    
    content.onclick = function (){
	  location.href = "http://www.facebook.com/group.php?gid=118123922126";
	  
    }
    
    container.appendChild(frame);
    container.appendChild(close);
    container.appendChild(content);
    container.appendChild(label);
    
    if (document.body == null){
      if (window.addEventListener){
        window.addEventListener("load", show, false);
      }
      else if (window.attachEvent){
        window.attachEvent("onload", show)
      }
    }
    else{
      show();
    }
    
  }
  
  function show(){
    document.body.appendChild(container);
    moveStart();
  }
  
  function moveStart(){
    moveBottom = -200;
    moveInterval = window.setInterval(move, 20);
    container.style.bottom = "-200px";
    container.style.display = "block";
  }
  
  function move(){
    if (moveBottom < 0){
      moveBottom ++;
      container.style.bottom = moveBottom + "px";
    }
    else{
      moveStop();
    }
  }
  
  function moveStop(){
    window.clearInterval(moveInterval);
    moveInterval = null;
  }
  
  function unmoveStart(){
    if (moveInterval != null){
      window.clearInterval(moveInterval);
    }
    moveInterval = window.setInterval(unmove, 20);
  }
  
  function unmove(){
    if (moveBottom > -200){
      moveBottom --;
      container.style.bottom = moveBottom + "px";
    }
    else{
      unmoveStop();
    }
  }
  
  function unmoveStop(){
    window.clearInterval(moveInterval);
    document.body.removeChild(container);
    container = null;
    frame = null;
    close = null;
    content = null;
    label = null;
  }
  
  init();
  
})();
Za kazdu odpoved vopred Dakujem :D
zaggi
Medium Star
Medium Star
Používateľov profilový obrázok
Príspevky: 314
Registrovaný: 04 feb 2007, 19:32

Re: uprava JS

Príspevok od používateľa zaggi »

za frame.style.width = "166px";

napis

frame.style.left = "50%";
frame.style.marginLeft = "-83px";
Napísať odpoveď