MyBB Depo Forum
javascript çakışma sorunu - Baskı Önizleme

+- MyBB Depo Forum (https://mybbdepo.com)
+-- Forum: MyBB 1.6 Depo (https://mybbdepo.com/mybb-1-6-depo-forumu)
+--- Forum: MyBB 1.6 Çözülmüş Soru ve Sorunlar (https://mybbdepo.com/mybb-1-6-cozulmus-soru-ve-sorunlar-forumu)
+--- Konu Başlığı: javascript çakışma sorunu (/javascript-cakisma-sorunu-konusu.html)



javascript çakışma sorunu - Esay - 19-06-2013

merhaba arkadaşlar. javascript dilini bilmiyorum, kendi çapımda çözmeye çalıştım ama yapamadım. bilen bir arkadaş yardım ederse sevinirim
bir tasarım için multi-color ve daralt/genişlet özelliği birden istendi.

<head> ve </head> arasındaki kodlar

multi color için böyle kod kullandım, genellikle color değerleri var.

HTML-Kodu:
Kod:
<link rel="alternate stylesheet" type="text/css" title="mavi" href="color/mavi.css" />
<link rel="alternate stylesheet" type="text/css" title="yesil" href="color/yesil.css" />
<link rel="alternate stylesheet" type="text/css" title="kirmizi" href="color/kirmizi.css" />
<script src="color/styleswitch.js" type="text/javascript"></script>
daralt/genişlet için böyle kod kullandım, cssde width değerleri var

HTML-Kodu:
Kod:
<link rel="alternate stylesheet" type="text/css" title="genis" href="genis.css" />
<link rel="alternate stylesheet" type="text/css" title="dar" href="dar.css" />
<script src="styleswitch.js" type="text/javascript"></script>
kodlar:

multi color
HTML-Kodu:
Kod:
<a href="javascript:NoiseStyle('mavi')">mavi</a>
<a href="javascript:NoiseStyle('yesil')">yesil</a>
<a href="javascript:NoiseStyle('kirmizi')">kirmizi</a>
daraltgenislet
HTML-Kodu:
Kod:
<a href="javascript:darrg('dar')">darr</a>
<a href="javascript:darrg('genis')">gens</a>

styleswitch.js dosyaları çakışıyor. şöyle anlatayım.
varsayılan stil css'indeyken daraltıp genişletebiliyorum.
ama diyelim kırmızı multi color css'ının değişme ikonuna tıkladım. kırmızı renk oldu. sonra daralt/genişlete tıklayınca daralt/genişlet ve multi color fonksiyonu yokmuş gibi stil css'indaki width e dönüyor.

multi color styleswitch

HTML-Kodu:
Kod:
function getCookie( 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 setCookie(name, value, expires)
{
   document.cookie = name + "=" + escape(value) + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString());
}

var exp = new Date();    
exp.setTime(exp.getTime() + (1000 * 60 * 60 * 24 * 30));    

function setActivestyleSheet(pTitle)
{
  var vLoop, vLink;
  for(vLoop=0; (vLink = document.getElementsByTagName("link")[vLoop]); vLoop++)
  {
   if(vLink.getAttribute("rel").indexOf("style")!= -1 && vLink.getAttribute("title"))
   {
    vLink.disabled = true;
    if(vLink.getAttribute("title") == pTitle)
    vLink.disabled = false;
   }
  }
}

function NoiseStyle(pTitle)
{
  setActivestyleSheet(pTitle)
  setCookie("mysheet",pTitle, exp);    
}

var pTitle=getCookie("mysheet")
setActivestyleSheet(pTitle)
daraltgenislet styleswitch

HTML-Kodu:
Kod:
function getCookie( 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 setCookie(name, value, expires)
{
   document.cookie = name + "=" + escape(value) + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString());
}

var exps = new Date();    
exps.setTime(exps.getTime() + (1000 * 60 * 60 * 24 * 30));    

function setActivestyleSheet(pTitles)
{
  var vLoops, vLinks;
  for(vLoops=0; (vLinks = document.getElementsByTagName("link")[vLoops]); vLoops++)
  {
   if(vLinks.getAttribute("rel").indexOf("style")!= -1 && vLinks.getAttribute("title"))
   {
    vLinks.disabled = true;
    if(vLinks.getAttribute("title") == pTitles)
    vLinks.disabled = false;
   }
  }
}

function darrg(pTitles)
{
  setActivestyleSheet(pTitles)
  setCookie("dargns",pTitles, exps);    
}

var pTitles=getCookie("dargns")
setActivestyleSheet(pTitles)



Cvp: javascript çakışma sorunu - Esay - 19-06-2013

Bi bakaydınız iyiydi sanki.