xkamui Their Destiny Was Foreordained | ok, alors voilà mon code :
- le fichier du formulaire :
Code :
- $Img=Array(0=>'img','wall','vids','skin','txt','util','tab');
- $Desc=Array(0=>'images','wallpapers','videos','skins WinAmp','textes','utilitaires','tableau wallpapers');
- $Texte=Array(0=>'','','','','','',
- '<TABLE width=100%><TR><TD><CENTER><IMG src=http://xkamui.wallpapers.free.fr/thumbs/000.jpg width=150 height=113 style=border: solid 1px; border-color: rgb(0, 0, 0)></CENTER></TD><TD><CENTER><IMG src=http://xkamui.wallpapers.free.fr/thumbs/000.jpg width=150 height=113 style=border: solid 1px; border-color: rgb(0, 0, 0)></CENTER></TD><TD><CENTER><IMG src=http://xkamui.wallpapers.free.fr/thumbs/000.jpg width=150 height=113 style=border: solid 1px; border-color: rgb(0, 0, 0)></CENTER></TD></TR></TABLE><BR>');
-
- For ($I=0;$I<7;$I++)
- {
- If ($I==3 || $I==6){echo "<BR>";}
- If ($I>5) {echo "<IMG onclick=\"insertElt('$Texte[$I]',4)\" src=\"images/news/add/$Img[$I].gif\" alt=\"ajout $Desc[$I]\" style=\"border: solid 1px; border-color: rgb(255, 255, 255)\"> ";}
- Else {echo "<IMG onclick=\"insertElt('<A Href=http://xkamui.com.free.fr/index.php3?C=$Img[$I]>$Desc[$I]</A>',4)\" src=\"images/news/add/$Img[$I].gif\" alt=\"ajout $Desc[$I]\" style=\"border: solid 1px; border-color: rgb(255, 255, 255)\"> ";}
- }
-
- echo "
- <FORM action=\"index.php3?F=news&C=addnews&Add=1\" method=\"Post\">
- <FONT size=\"2\" color=\"#FFFFFF\" Face=\"Arial\"><B>News : </B></FONT><BR>
- <TEXTAREA name=\"contenu\" cols=\"60\" rows=\"15\" ONFOCUS=\"storeCaret(this);\" ONSELECT=\"storeCaret(this);\" ONCLICK=\"storeCaret(this);\" ONKEYUP=\"storeCaret(this)\" class=\"champ\"></TEXTAREA><BR>
- <INPUT type=\"submit\" value=\"submit\" class=\"bouton\">
- </FORM>
- ";
|
Code :
- var style = new Array('g','/g','i','/i','s','/s','email','/email','lien=','/lien','img','/img','quote','/quote');
- var stockage = new Array('0','0','0','0','0','0','0','0','0','0','0','0','0');
- lien="http://";
- function MM_findObj(n, d)
- {
- var p,i,x; if(!d) d=document; if((p=n.indexOf("?" ))>0&&parent.frames.length)
- {
- d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
- }
- if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
- for(i=0;!x&&d.layers&&i>d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
- }
- function storeCaret (textEl)
- {
- if (textEl.createTextRange)
- textEl.caretPos = document.selection.createRange().duplicate();
- }
- function insertAtCaret (textEl, text)
- {
- if (textEl.createTextRange && textEl.caretPos)
- {
- var caretPos = textEl.caretPos;
- caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
- }
- }
- function insertInCaret (textEl, text, text2)
- {
- if (textEl.createTextRange && textEl.caretPos)
- {
- var caretPos = textEl.caretPos;
- selectedtext = caretPos.text;
- caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == '' ? text + '' : text;
- caretPos.text = caretPos.text + selectedtext + text2;
- }
- }
- function palette(id,vernav)
- {
- if (vernav>=4)
- {
- MM_findObj('contenu').focus();
- if (MM_findObj('contenu').createTextRange && MM_findObj('contenu').caretPos)
- {
- var caretPos = MM_findObj('contenu').caretPos;
- if (caretPos.text.length>0)
- {
- if (id!=8)
- {
- insertInCaret(MM_findObj('contenu'),"["+style[id]+"]","["+style[id+1]+"]" );
- }
- else
- {
- geturl = prompt("veuillez entrer l'url",'http://');
- insertInCaret(MM_findObj('contenu'),"["+style[id]+geturl+"]","["+style[id+1]+"]" );
- }
- }
- else
- {
- if ( (countbalise('['+style[id],'contenu')+countbalise('['+style[id+1],'contenu'))%2 == 0)
- {
- if (id!=8)
- {
- insertAtCaret(MM_findObj('contenu'),"["+style[id]+"]" );
- }
- else
- {
- geturl = prompt("veuillez entrer l'url",'http://');
- insertAtCaret(MM_findObj('contenu'),"["+style[id]+geturl+"]" );
- }
- }
- else
- {
- insertAtCaret(MM_findObj('contenu'),"["+style[id+1]+"]" );
- }
- MM_findObj('contenu').focus()
- }
- }
- }
- else
- {
- if (stockage[id] == '0')
- {
- var temp = document.hop.contenu.value;
- document.hop.contenu.value=temp+' '+'['+style[id]+']';
- stockage[id] = '1';
- }
- else
- {
- var temp = document.hop.contenu.value;
- document.hop.contenu.value=temp+'['+style[id+1]+']'+' ';
- stockage[id] = '0';
- }
- }
- }
- function countbalise(b,ch)
- {
- count = 0;
- pos = MM_findObj(ch).value.indexOf(b);
- while ( pos != -1 )
- {
- count++;
- pos = MM_findObj(ch).value.indexOf(b,pos+1);
- }
- return count;
- }
- function insertElt(MyString,vernav)
- {
- if (vernav>=4)
- {
- MM_findObj('contenu').focus();
- if ((MM_findObj('contenu').createTextRange) && (MM_findObj('contenu').caretPos))
- {
- var caretPos = MM_findObj('contenu').caretPos;
- if (caretPos.text.length>0)
- insertInCaret(MM_findObj('contenu'),MyString,"" );
- else
- insertAtCaret(MM_findObj('contenu'),MyString);
- }
- }
- else
- {
- var temp = document.hop.contenu.value;
- document.hop.contenu.value=temp+MyString;
- }
- }
- function insertTag(MyString,vernav)
- {
- if (vernav>=4)
- {
- MM_findObj('contenu').focus();
- if (MM_findObj('contenu').createTextRange && MM_findObj('contenu').caretPos)
- {
- var caretPos = MM_findObj('contenu').caretPos;
- if (caretPos.text.length>0)
- {
- insertInCaret(MM_findObj('contenu'),"["+MyString+"]","[/"+MyString+"]" );
- }
- else
- {
- if ( (countbalise('['+MyString,'contenu')+countbalise('[/'+MyString,'contenu'))%2 == 0)
- {
- insertAtCaret(MM_findObj('contenu'),"["+MyString+"]" );
- }
- else
- {
- insertAtCaret(MM_findObj('contenu'),"[/"+MyString+"]" );
- }
- MM_findObj('contenu').focus();
- }
- }
- }
- else
- {
- if (stockage[12] == '0')
- {
- var temp = document.hop.contenu.value;
- document.hop.contenu.value=temp+' '+'['+MyString+']';
- stockage[12] = '1';
- }
- else
- {
- var temp = document.hop.contenu.value;
- document.hop.contenu.value=temp+'[/'+MyString+']'+' ';
- stockage[12] = '0';
- }
- }
- }
- ///Color
- col0 = new Array(255,0,0,255,0,0);
- col1 = new Array(0,0,255,0,0,255);
- col2 = new Array(0,0,0,0,255,0);
- col3 = new Array(0,255,0,255,0,0);
- var base_hexa = "0123456789ABCDEF";
- function dec2Hexa(number)
- {
- return base_hexa.charAt(Math.floor(number / 16)) + base_hexa.charAt(number % 16);
- }
- function RGB2Hexa(TR,TG,TB)
- {
- return "#" + dec2Hexa(TR) + dec2Hexa(TG) + dec2Hexa(TB);
- }
- function lightCase(MyObject)
- {
- MM_findObj('ColorUsed').bgColor = MyObject.bgColor;
- }
- function rgb(dm,ta,vernav)
- {
- if (vernav>=4)
- {
- fm = dm + 18;
- for (i=dm;i<fm+1;i++)
- {
- r = Math.floor(ta[0] + (i-dm)*(ta[1]-ta[0])/(fm-dm));
- g = Math.floor(ta[2] + (i-dm)*(ta[3]-ta[2])/(fm-dm));
- b = Math.floor(ta[4] + (i-dm)*(ta[5]-ta[4])/(fm-dm));
- codehex = r + '' + g + '' + b;
- document.write(' <td bgColor=\"' + RGB2Hexa(r,g,b) + '\" onClick=\"insertTag(this.bgColor,5);lightCase(this);\" title=\"Mettre en couleur. Syntaxe : [#' + codehex + ']texte[/#' + codehex +' ]\" width=\"4\" height=\"17\"></td>\n');
- }
- }
- }
|
[i](qui n'est d'ailleurs que le fichier de hfr) Message édité par xkamui le 18-08-2002 à 00:26:49
|