Bonjour,
J'ai créer un tchat, j'ai mis une image qui ouvre une popup de ma page color.html qui est une grille de quelque couleur. Qui servira à coloré le texte de la couleur choisi par le membre et lui évité de tapé tout le temps les balises.
J'aimerais qu'au click sur la couleur choisi sa envoie le formulaire à la page déjà ouverte, pour pouvoir la récupéré et l'envoyer avec le formulaire du message du membre.
Merci de votre aide !
un apercu ici: http://testtchat.bl.ee/couleur.html
color.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-script-type" content="text/javascript"/>
<meta http-equiv="content-style-type" content="text/css"/>
<title>Couleur</title>
<script type="text/javascript">
window.resizeTo(250, 265);
function fetch_object(idname) {
if (document.getElementById) {
return document.getElementById(idname);
}
else if (document.all) {
return document.all[idname];
}
else if (document.layers) {
return document.layers[idname];
}
else {
return null;
}
}
function Init() {
var color = window.dialogArguments;
color = ValidateColor(color) || '000000';
View(color);
}
function View(color) {
fetch_object("ColorPreview").style.backgroundColor = '#' + color;
fetch_object("ColorHex").value = '#' + color;
}
function Set(string) {
var color = ValidateColor(string);
if (color == null) {
alert("Invalid color code: " + string);
}
else {
View(color);
opener.fetch_object('show_color').style.backgroundColor = '#' + color;
opener.fetch_object('scolor').value = color;
opener.fetch_object('message').style.color = '#' + color;
SetCookie('CB_color', color);
window.close();
}
}
function ValidateColor(string) {
string = string || '';
string = string + "";
string = string.toUpperCase();
var chars = '0123456789ABCDEF';
var out = '';
for (var i = 0; i < string.length; i++) {
var schar = string.charAt(i);
if (chars.indexOf(schar) != -1) {
out += schar;
}
}
if (out.length != 6) {
return null;
}
return out;
}
</script>
</head>
<body style="background: buttonface; margin: 0px; padding: 0px" onload="Init();">
<form method="get" style="margin: 0px; padding: 0px" action=""
onsubmit="Set(document.getElementById('ColorHex').value); return false;">
<table border="0" cellspacing="0" cellpadding="4" width="100%">
<tr>
<td style="background: buttonface" valign="middle">
<div style="background-color: #000000; padding: 1; height: 21px; width: 50px">
<div id="ColorPreview" style="height: 100%; width: 100%"></div>
</div>
</td>
<td style="background: buttonface" valign="middle"><input type="text" name="ColorHex" id="ColorHex" value="" size="15" style="font-size: 12px"/></td>
<td style="background: buttonface" width="100%"></td>
</tr>
</table>
</form>
<table border="0" cellspacing="1" cellpadding="0" width="100%" bgcolor="#000000" style="cursor: pointer;">
<tr>
<td bgcolor="#000000" onmouseover="View('000000');" onclick="Set('000000');" height="10" width="10"></td>
<td bgcolor="#000000" onmouseover="View('000000');" onclick="Set('000000');" height="10" width="10"></td>
...
</tr>
<tr>
<td bgcolor="#333333" onmouseover="View('333333');" onclick="Set('333333');" height="10" width="10"></td>
<td bgcolor="#000033" onmouseover="View('000033');" onclick="Set('000033');" height="10" width="10"></td>
...
</tr>
<tr>
<td bgcolor="#666666" onmouseover="View('666666');" onclick="Set('666666');" height="10" width="10"></td>
<td bgcolor="#000066" onmouseover="View('000066');" onclick="Set('000066');" height="10" width="10"></td>
...
</tr>
<tr>
<td bgcolor="#999999" onmouseover="View('999999');" onclick="Set('999999');" height="10" width="10"></td>
<td bgcolor="#000099" onmouseover="View('000099');" onclick="Set('000099');" height="10" width="10"></td>
...
</tr>
<tr>
<td bgcolor="#CCCCCC" onmouseover="View('CCCCCC');" onclick="Set('CCCCCC');" height="10" width="10"></td>
<td bgcolor="#0000CC" onmouseover="View('0000CC');" onclick="Set('0000CC');" height="10" width="10"></td>
...
</tr>
<tr>
<td bgcolor="#FFFFFF" onmouseover="View('FFFFFF');" onclick="Set('FFFFFF');" height="10" width="10"></td>
<td bgcolor="#0000FF" onmouseover="View('0000FF');" onclick="Set('0000FF');" height="10" width="10"></td>
...
</tr>
<tr>
<td bgcolor="#FF0000" onmouseover="View('FF0000');" onclick="Set('FF0000');" height="10" width="10"></td>
<td bgcolor="#990000" onmouseover="View('990000');" onclick="Set('990000');" height="10" width="10"></td>
...
</tr>
<tr>
<td bgcolor="#00FF00" onmouseover="View('00FF00');" onclick="Set('00FF00');" height="10" width="10"></td>
<td bgcolor="#990033" onmouseover="View('990033');" onclick="Set('990033');" height="10" width="10"></td>
...
</tr>
<tr>
<td bgcolor="#0000FF" onmouseover="View('0000FF');" onclick="Set('0000FF');" height="10" width="10"></td>
<td bgcolor="#990066" onmouseover="View('990066');" onclick="Set('990066');" height="10" width="10"></td>
...
</tr>
<tr>
<td bgcolor="#FFFF00" onmouseover="View('FFFF00');" onclick="Set('FFFF00');" height="10" width="10"></td>
<td bgcolor="#990099" onmouseover="View('990099');" onclick="Set('990099');" height="10" width="10"></td>
...
</tr>
<tr>
<td bgcolor="#00FFFF" onmouseover="View('00FFFF');" onclick="Set('00FFFF');" height="10" width="10"></td>
<td bgcolor="#9900CC" onmouseover="View('9900CC');" onclick="Set('9900CC');" height="10" width="10"></td>
...
</tr>
<tr>
<td bgcolor="#FF00FF" onmouseover="View('FF00FF');" onclick="Set('FF00FF');" height="10" width="10"></td>
<td bgcolor="#9900FF" onmouseover="View('9900FF');" onclick="Set('9900FF');" height="10" width="10"></td>
...
</tr>
</table>
</body>
</html>
Afficher la suite