Retour variable palette graphique

neooh56 Messages postés 3 Date d'inscription mardi 23 novembre 2004 Statut Membre Dernière intervention 4 mars 2010 - 28 nov. 2005 à 23:51
cs_djagger Messages postés 536 Date d'inscription lundi 5 mai 2003 Statut Membre Dernière intervention 29 janvier 2009 - 30 nov. 2005 à 13:40
Bonjour

J'ai recupéré un script de pallette graphique je clic sur un bouton ca ouvre la palette et quand je clic sur une couleur ca la ferme et renvoie la couleur. Mon probleme est que je n'arrive pas a recupperer la variable couleur

voici mes codes:

Page bouton:

);" style="width:45px;height:15px;background-color:<? echo $color;?>;">

le script popup_color_picker


function popup_color_picker(couleur)

{

var width = 400;

var height = 250;

window.open('color_picker.php?nbrcoul1='+couleur+'', 'cp', 'resizable=no, location=no, width='

+width+', height='+height+', menubar=no, status=yes, scrollbars=no, menubar=no');

}
page ou il y a la palette graphique:


<!-- note: this version of the color picker is optimized for IE 5.5+ only -->

<html STYLE="width: 238px; height: 208px"><head><title>Select Color</title>

<script language="javascript">

function _CloseOnEsc() {

if (event.keyCode == 27) { window.close(); return; }

}

function Init() { // run on page load

document.body.onkeypress = _CloseOnEsc;

color = window.dialogArguments;

color = ValidateColor(color) || '000000';

View(color); // set default color

}

function View(color) { // preview color

document.all.ColorPreview.style.backgroundColor = '#' + color;

document.all.ColorHex.value = '#' + color;

}

function Set(string) { // select color

color = ValidateColor(string);

if (color == null) { alert("Invalid color code: " + string); } // invalid color

else { // valid color

View(color); // show selected color

window.returnValue = color; // set return value

window.close(); // close dialog

}

}

function ValidateColor(string) { // return valid color code

string = string || '';

string = string + "";

string = string.toUpperCase();

chars = '0123456789ABCDEF';

out = '';

for (i=0; i<string.length; i++) { // remove invalid color chars

schar = string.charAt(i);

if (chars.indexOf(schar) != -1) { out += schar; }

}

if (out.length != 6) { return null; } // check length

return out;

}

</script>

<STYLE>

td {font-family: MS Shell Dlg; font-size: 9pt;cursor: hand;}

</STYLE>

</head>

<form method=get onSubmit="Set(document.all.ColorHex.value); return false;">

<table border=0 cellspacing=0 cellpadding=4 width=100%>

----,

</td>





<script language=\"JavaScript\">

<!--

var x = new Array('00','33','66','99','CC','FF');

var y = new Array('000000','333333','666666','999999','CCCCCC','FFFFFF','FF0000','00FF00','0000FF','FFFF00','00FFFF','FF00FF');

i=0;

for (d=0;d<2;d++) {

for (c=0;c<6;c++) {

document.write('----
, , , ');

i++;

for (b=0;b<3;b++) {

for (a=0;a<6;a++) {

r=x[b+3*d]+x[a]+x[c];

document.write(', ');

}

}

document.write('');

}

}

//-->

</script>






</form>

</html>

</TD></TR></TBODY></TABLE>en fait je pense qui faut changer la methode de recuperation

window.returnValue = color;
de la variable mais j'ai aucune idee de comment faire.

voila merci de votre aide.

@+++

2 réponses

cs_djagger Messages postés 536 Date d'inscription lundi 5 mai 2003 Statut Membre Dernière intervention 29 janvier 2009 1
30 nov. 2005 à 13:38
Salut !

Essay
0
cs_djagger Messages postés 536 Date d'inscription lundi 5 mai 2003 Statut Membre Dernière intervention 29 janvier 2009 1
30 nov. 2005 à 13:40
'tain ca a buggé !
donc essay, à la place de window.returnValue=color :

window.opener.validColor(color);

Et dans la page qui ouvre le popup :
function validColor(maCouleur)
{
alert(maCouleur);
}

allé a+++
0
Rejoignez-nous