IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

redimensionner script sudoku


Sujet :

JavaScript

  1. #1
    Nouveau candidat au Club
    Profil pro
    Inscrit en
    Septembre 2006
    Messages
    1
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2006
    Messages : 1
    Par défaut redimensionner script sudoku
    Bonjour,

    j'ai un script de sudoku mais je n'arrive pas à redimensionner le jeu, il s'adapte à la pâge et cela fait un jeu énorme!
    Puvez vous m'aider http://sudokustar.free.fr

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    <SCRIPT type="text/JavaScript">//<SCRIPT language=Javascript>
    var	debug=false,
    	txtC=new Array('black','blue','green','red','white'),
    	size=new Array(3), full,
    	sz=new Array(3), fll,
    	xName=new Array(36), yName=new Array(36), zName=new Array(36), 
    	xyz=new Array(3),	// xyz[0]=rows, xyz[1]=columns, xyz[2]=regions
    	xy=new Array(),		// row & column intersections = cells
    	currentSize=new Array(2),
    	timerID=null, d1=0, d2, d3,
    	guess=new Array();
     
    for (i=0;i<26;i++)  {xName[i]=String.fromCharCode((65+i)); yName[i]=(i+1).toString();}
    for (i=26;i<36;i++) {xName[i]='A'+String.fromCharCode((65+i-26)); yName[i]=(i+1).toString();}
     
    /*
    k, k1:	0|1	0|1|2	0|1|2|3
    	-+-	-+-+-	-+-+-+-
    	2|3	3|4|5	4|5|6|7
    		-+-+-	-+-+-+-
    		6|7|8	8|9|...	*/
     
    function i_k(k,k1) {return Math.floor(k/size[0])*size[0]+Math.floor(k1/size[1]);}
    function j_k1(k,k1) {return k%size[0]*size[1]+k1%size[1];}
     
    function createGrid()	// & associated objects
     {
     document.oncontextmenu=new Function("return false");
     d=page();
     var i, j, k, n=Math.max(16,Math.floor((d[1]-55)/size[2]-6)),
    	inp='<input type="text" class="in" maxLength=1 '
    	//+'style="width:'+n+'px;height:'+n+'px;line-height:'+(n-2)+';font-size:'+(n-4)+'px" '	//doesn't work under IE!
    	+'id="x', s='<table cellSpacing=0 cellPadding=1 class="gr">';
     for (i=0;i<=size[2];i++)
      {
      s+='<tr>';
      for (j=0;j<=size[2];j++)
       {
       if (i==0 && j==0)	s+='<td></td>';
       else if (j==0)	s+='<td class="tdRl">'+(size[2]<37?xName[i-1]:'&nbsp;')+'</td>';
       else if (i==0)	s+='<td class="tdBt">'+(size[2]<37?yName[j-1]:'&nbsp;')+'</td>';
       else
        {
        if (i%size[0]==0 && j%size[1]==0)	s+='<td class="tdBR">';
        else if (i%size[0]==0)		s+='<td class="tdB">';
        else if (j%size[1]==0)		s+='<td class="tdR">';
        else				s+='<td class="tdC">';
        s+=inp+((i-1).toString(36))+'y'+((j-1).toString(36))+'"></td>';
       }}
      s+='</tr>';
      }
     document.getElementById('Grid').innerHTML=s+'</table>';
     for (k=0;k<size[2];k++)
      zName[k]='['+xName[i_k(k,0)]+','+yName[j_k1(k,0)]+']...['
    	+xName[i_k(k,size[2]-1)]+','+yName[j_k1(k,size[2]-1)]+']';
     for (i=0;i<size[2];i++)
      {
      xy[i]=new Array(size[2]);
      for (j=0;j<size[2];j++)
       {
       xy[i][j]=new Object();
       xy[i][j].g=eval('document.grid.x'+i.toString(36)+'y'+j.toString(36));
       xy[i][j].h=full;	//g for grid; h for hidden candidats
       xy[i][j].i=i;
       xy[i][j].j=j;
       xy[i][j].k =i_k(i,j);
       xy[i][j].k1=j_k1(i,j);
       xy[i][j].g.onkeydown=keyD;
       xy[i][j].g.onkeypress=keyP;
       xy[i][j].g.onmousedown=mouseR;
       xy[i][j].g.i=i;
       xy[i][j].g.j=j;
      }}
     for (n=0;n<3;n++)
      {
      xyz[n]=new Array(size[2]);
      for (i=0;i<size[2];i++)
       {
       xyz[n][i]=new Object();
       xyz[n][i].h=full;
       xyz[n][i].c=new Array(size[2]);
       for (j=0;j<size[2];j++)
        {
        if (n==0)		xyz[n][i].c[j]=xy[i][j];
        else if (n==1)	xyz[n][i].c[j]=xy[j][i];
        else xyz[n][i].c[j]=xy[i_k(i,j)][j_k1(i,j)];
     }}}}
     
    
    //////	adaptation to the window's sizes
     
    function page()
     {
     var d=new Array(2), s='';
     if (window.innerWidth)
      {d[0]=window.innerWidth; d[1]=window.innerHeight;}
     else
      {
      if (document.documentElement)	s=document.documentElement;
      else if (document.body)	s=document.body;
      if (s.clientWidth)		{d[0]=s.clientWidth; d[1]=s.clientHeight;}
      else if (s.offsetWidth)	{d[0]=s.offsetWidth; d[1]=s.offsetHeight;}
      }
     return d;
     }
     
    function gridSize()
     {
     var i, j, n, d=page();
     if ((d[0]<550 || d[1]<250) && parseInt(navigator.appVersion)>3)
      {
      d[0]=Math.max(600,d[0]+20); d[1]=Math.max(430,d[1]+130);
      if (navigator.appName=="Netscape") {top.outerWidth=d[0]; top.outerHeight=d[1];}
      else top.resizeTo(d[0],d[1]);
      d=page();
      }
     if (Math.abs(d[1]-currentSize[1])<20)
      return;
     top.location.href=window.location.href;
     }

  2. #2
    Membre Expert
    Avatar de ®om
    Profil pro
    Inscrit en
    Janvier 2005
    Messages
    2 815
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2005
    Messages : 2 815
    Par défaut
    Tu es dans la section JAVA là !!!

  3. #3
    Membre Expert
    Profil pro
    Fabrication GED
    Inscrit en
    Octobre 2005
    Messages
    1 405
    Détails du profil
    Informations personnelles :
    Âge : 46
    Localisation : France, Seine Maritime (Haute Normandie)

    Informations professionnelles :
    Activité : Fabrication GED

    Informations forums :
    Inscription : Octobre 2005
    Messages : 1 405
    Par défaut
    +1
    java et javascript sont deux choses totalement différentes. Nous t'invitons à reposter ton problème dans la section javascript.
    Et Ce sera beaucoup plus lisible.

Discussions similaires

  1. [Galerie] Script de redimensionnement d'images carrées
    Par Sayrus dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 8
    Dernier message: 15/06/2009, 08h49
  2. Script en shell, redimensionner des images
    Par recome dans le forum Shell et commandes GNU
    Réponses: 7
    Dernier message: 19/03/2009, 12h37
  3. Réponses: 4
    Dernier message: 14/12/2008, 16h52
  4. Réponses: 5
    Dernier message: 30/11/2008, 00h17
  5. [Forum] Script upload + redimensionnement image jpg
    Par baleiney dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 6
    Dernier message: 03/07/2006, 11h27

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo