mehmet: cookie anpassen

hallo forum, bitte nimmt es mir nicht übel, wenn ich mich an euch wende ich benötige eure information folgender script speichert den cookie style up wenn ich den teil nach oben der seite lege, wird der bgcolor & textcolr gespeichert aber nicht textstyle

wenn ich allerding teil 1 und 2 vertausche, wird der textstyle gespeichert, aber nicht bgcolor und textcolor

die cookies werden angespeichert in meiner temp folder allerdings scheint es nicht auszulesen

könntet ihr noch einmal übergucken bitte ich habe bestimmt etwas übersehen

dank im voraus gruss mehmet

<!-- ################### TEIL 1 BEGIN ############################## ---> <hr> <script language="javascript"> <!-- var x; var tob=0;  //when tob = 0, change background, if tob = 1 change text

function switchTb() { var sel=document.frm.doc.options[document.frm.doc.selectedIndex].value;  if(sel=="back")   {tob=0;}  else   {tob=1;} }

var d=new Date(); d.setTime(d.getTime()+(100060602430)); var thecookie; var fgcookie;

function check() { checkbg() ckeckfg() }

function checkbg() { if(document.cookie.indexOf("bgcolor")!=-1)  {  thecookie=document.cookie;  var cut=thecookie.indexOf("bgcolor=");  var color=thecookie.substring(cut+8,cut+15);  document.bgColor=color;  } }

function ckeckfg() { if(document.cookie.indexOf("fgcolor")!=-1)  {  fgcookie=document.cookie;  var cut=fgcookie.indexOf("fgcolor=");  var color=fgcookie.substring(cut+8,cut+15);  document.fgColor=color;  } } function create(x) { if(tob==0){createbg(x)} if(tob==1){createfg(x)} }

function createbg(x) { if(document.cookie.indexOf("bgcolor")==-1 && tob==0)  {  document.cookie="bgcolor="+x+";expires="+d.toGMTString();  document.bgColor=x;  } else if(tob==0)  {  document.cookie="bgcolor="+x+";expires="+d.toGMTString();  thecookie=document.cookie;  document.bgColor=x;  } }

function createfg(x) { if(document.cookie.indexOf("fgcolor")==-1 && tob==1)  {  document.cookie="fgcolor="+x+";expires="+d.toGMTString();  document.fgColor=x;  } else  {  document.cookie="fgcolor="+x+";expires="+d.toGMTString();  fgcookie=document.cookie;  document.fgColor=x;  } }

//--> </script>

</HEAD>

<BODY onLoad="check()" >

</p>

<form name="frm"> <select name="doc" onchange="switchTb()"> <option value="back" >background <option value="text" >text </select> </form> <BR> <input type="button" style="background-color: '#000000'" onclick="create('#000000')"> <input type="button" style="background-color: '#808080'" onclick="create('#808080')"> <input type="button" style="background-color: '#C0C0C0'" onclick="create('#C0C0C0')"> <input type="button" style="background-color: '#66FFFF'" onclick="create('#66FFFF')"> <input type="button" style="background-color: '#7BE2EF'" onclick="create('#7BE2EF')"> <input type="button" style="background-color: '#6BA7D6'" onclick="create('#6BA7D6')"> <input type="button" style="background-color: '#0066CC'" onclick="create('#0066CC')"> <input type="button" style="background-color: '#6363CE'" onclick="create('#6363CE')"> <input type="button" style="background-color: '#330099'" onclick="create('#330099')"> <input type="button" style="background-color: '#5D0063'" onclick="create('#5D0063')"> <input type="button" style="background-color: '#FF99CC'" onclick="create('#FF99CC')"> <input type="button" style="background-color: '#B85FA3'" onclick="create('#B85FA3')"> <input type="button" style="background-color: '#B188CF'" onclick="create('#B188CF')"> <input type="button" style="background-color: '#FFCC00'" onclick="create('#FFCC00')"><BR><BR> <input type="button" style="background-color: '#FFFF00'" onclick="create('#FFFF00')"> <input type="button" style="background-color: '#EAEF7B'" onclick="create('#EAEF7B')"> <input type="button" style="background-color: '#66FF00'" onclick="create('#66FF00')"> <input type="button" style="background-color: '#006633'" onclick="create('#006633')"> <input type="button" style="background-color: '#339999'" onclick="create('#339999')"> <input type="button" style="background-color: '#336600'" onclick="create('#336600')"> <input type="button" style="background-color: '#666600'" onclick="create('#666600')"> <input type="button" style="background-color: '#996633'" onclick="create('#996633')"> <input type="button" style="background-color: '#990000'" onclick="create('#990000')"> <input type="button" style="background-color: '#FF0000'" onclick="create('#FF0000')"> <input type="button" style="background-color: '#B8855F'" onclick="create('#B8855F')"> <input type="button" style="background-color: '#FF6600'" onclick="create('#FF6600')"> <input type="button" style="background-color: '#FFAB6B'" onclick="create('#FFAB6B')"> <hr> <!-- ################### TEIL 1 ENDE ############################## --->

<!-- ################### TEIL 2 BEGIN ############################## ---> <hr> <script language="JavaScript"> // Standard setting, separate fonts with "," and make sure to set standardfont // and size to avoid errors var fonts="Arial,Times New Roman,Verdana,Courier,Impact,Terminal,Verdana,Comic Sans MS,Arial Narrow,Estrangelo Edessa,Courier New,Modern,Monotype Corsiva".split(","); var standardfont="Arial" var standardsize="90%"

var nosave=false; /*  function drawform()  adds the standard form to the document. */ function drawform(){     if (!document.layers){  document.write("<form action="/" name="dynform" class="dynform">");  document.write("<input type="button" class="dynbutton" onclick="addSize(-10)" value="smaller" style="width: 80; height: 40" />");  document.write("<input type="button" class="dynbutton" onclick="addSize(10)" value="larger" style="width: 80; height: 40" />");  document.write("<br>");  document.write("<select class="dynselect" name="typeface" onchange="setFont(this.options[this.selectedIndex].value)">");  for (i=0;i<fonts.length;i++){   document.write(" <option value=""+fonts[i]+"">"+fonts[i]+"</option>");  }  document.write("</select>");  document.write("<br>");  document.write("</form>");  } }

/*  function init()  loads the cookiedata and changes the document accordingly, if there is no  cookie, sets the standard settings and stores it / function init(){     if (!document.layers){  size=getCookie("dynfontsize");  if (size!=null){   c=size.split(":");   document.getElementsByTagName("body").item(0).style.fontSize=c[0];   document.getElementsByTagName("body").item(0).style.fontFamily=c[1];  }  if (size==null || c[0]=="" || c[1]==""){   document.getElementsByTagName("body").item(0).style.fontSize=standardsize;   document.getElementsByTagName("body").item(0).style.fontFamily=standardfont;   storeSize()   }  }  // // Special setting, if you want to use the "don't save" chekbox  // nosave=document.dynform.nosave.checked } /  function addSize(add)  increases the size of the document font by "add", negative values make the  font smaller. / function addSize(add){     if (!document.layers){  doc = document.getElementsByTagName("body").item(0)  size=parseInt(doc.style.fontSize)+add;  doc.style.fontSize=size+"%";  if (nosave==false) storeSize()  } } /  function SetSize(add)  sets the font size of the document. */ function setSize(add){     if (!document.layers){  document.getElementsByTagName("body").item(0).style.fontSize=add+"%";  if (nosave==false) storeSize()  } }

/*  function SetFont(add)  sets the font face of the document. */ function setFont(add){     if (!document.layers){  doc = document.getElementsByTagName("body").item(0)  doc.style.fontFamily=add;  if (nosave==false) storeSize()  } }

/*  function storeSize()  saves the current settings of the document in a cookie / function storeSize(){  var exp = new Date();  exp.setTime(exp.getTime() + 246060901000);  size=document.getElementsByTagName("body").item(0).style.fontSize;  font=document.getElementsByTagName("body").item(0).style.fontFamily;  setCookie("dynfontsize",size+":"+font,exp); } /  function setCookie()  sets the cookie / function setCookie(name, value, expires, path, domain, secure) {  var curCookie = name + "=" + escape(value) +  ((expires) ? "; expires=" + expires.toGMTString() : "") +  ((path) ? "; path=" + path : "") +  ((domain) ? "; domain=" + domain : "") +  ((secure) ? "; secure" : "")  document.cookie = curCookie } /  function getCookie()  reads the cookie */ function getCookie(name) {  var prefix = name + "="  var cookieStartIndex = document.cookie.indexOf(prefix)  if (cookieStartIndex == -1)  return null  var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex +  prefix.length)  if (cookieEndIndex == -1)  cookieEndIndex = document.cookie.length  return unescape(document.cookie.substring(cookieStartIndex +  prefix.length,  cookieEndIndex)) }

</script>

<body onload="init()">   <!-- CookieFont -->

<table border="1">   <tr>     <td align="center" valign="top">color</td>     <td align="center" valign="top">text</td>   </tr>   <tr>     <td align="center" valign="top">links. mitte</td>     <td align="center" valign="top">rechts mitte</td>   </tr>   <tr>     <td align="center" valign="bottom">links unten</td>     <td align="center" valign="bottom"><script language="JavaScript">drawform();</script>&nbsp;</td>   </tr> </table> <hr> <!-- ################### TEIL 2 ENDE ############################## --->

<!-- ################### TEIL 3 BEGIN ############################## ---> <hr> Change your style! <hr> <!-- ################### TEIL 3 ENDE ############################## --->

  1. hallo mehmet,

    das ist mir zuviel code; mach ne leuchtkugel draus, ein beispiel-code, der nur das problem umschreibt. oft findet sich beim erstellen diese codes schon der fehler. wenn nicht, lässt es sich hier leicht begutachten. mag es daran liegen, dass du den cookie-inhalt nicht korrekt ausliest oder rückinterpretierst?

    gruß, frankx

    1. hallo frankx,
      erstmal dank für dein reply

      du hast recht
      zuviel code! für mich als leien sehr schwer nachvollziehbar

      könntest du hierbei weiterhelfen bitte

      ich denke, dass dies mich paarwochen beschäftigen könnte
      (muss arbeiten, kinder, familie, einkaufen...)
      ich habe leider sehr wenig freizeit zbgl.

      es waehre sehr hilfreich, wenn du mir bitte unter die arme
      greifen könntest.

      bis ich - als leihe, des rätsels lösung finde...

      es waehre echt lieb von dir

      oder kennst du einen script, wo der user selber seinen style
      (bgcolor, txtcolor, textstyle, textsize) einstellen kann und
      dies sollte als cookie gespeichert werden

      dank dir im voraus
      gruss
      mehmet

      1. hallo mehmet,

        dir gehts wie mir. keine zeit, deine arbeit zu machen. aber helfen, wenn die selbsthilfe nicht mehr geht gerne. auch kinder und und und.

        google, und suche im forum, oder umreisse möglichst prägnant dein problem...;

        gruß, frankx