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 :

Erreur d'affichage de l'éditeur wysiwyg avec Firefox


Sujet :

JavaScript

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Septembre 2006
    Messages
    200
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2006
    Messages : 200
    Points : 73
    Points
    73
    Par défaut Erreur d'affichage de l'éditeur wysiwyg avec Firefox
    Bonjour,

    J'ai un probleme avec FireFox,
    ce morceau de code .....
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    <script language="javascript1.2">
    		generate_wysiwyg('englishHtml');
    	</script>
    fonctionne bien avec IExplorer mais pas avec FireFox
    quelqu'un a une idée pourquoi?

    merci
    voir image attachée.


    voici le code de la jsp.
    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
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <HTML>
    <HEAD>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ page 
    language="java"
    contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"
    %>
    <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <META name="GENERATOR" content="IBM WebSphere Studio">
    <META http-equiv="Content-Style-Type" content="text/css">
    <LINK href="theme/Master.css" rel="stylesheet" type="text/css">
    <TITLE>Note2.jsp</TITLE>
     
     
    <script language="JavaScript" type="text/javaScript" src="wysiwyg.js">
    </script>
     
    </HEAD>
    <BODY>
    <P>Place content here.</P>
     
    <html:form action="displayNotice.do">
     
     
     
    	<TABLE border="0" cellspacing="0" cellpadding="1" width="400">
    		<TR>
    			<TD>&nbsp;</TD>
    		</TR><TR>
    			<TD><bean:message key="notice.englishText" /></TD>
    		</TR>
    		<TR>
    			<TD><html:textarea name="frmNotice" property="englishHtml"
    				style="height: 200px; width: 600px" cols="29" /></TD>
    		</TR>
    	</TABLE>
    	<script language="javascript1.2">
    		generate_wysiwyg('englishHtml');
    	</script>
     
     
     
     
    </html:form>
     
    </BODY>
    </HTML>
    Images attachées Images attachées  

  2. #2
    Membre actif
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2007
    Messages
    241
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2007
    Messages : 241
    Points : 272
    Points
    272
    Par défaut
    as tu essayé en rajoutant l'attribut type="text/javascript" a la balise script, li me semble qu'il est obligatoire

  3. #3
    Membre régulier
    Profil pro
    Inscrit en
    Septembre 2006
    Messages
    200
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2006
    Messages : 200
    Points : 73
    Points
    73
    Par défaut
    Psylox, ça ne donne rien avec l'option: type="text/javascript"
    je ne sais vraiment pas d'ou ça peut venir.....

  4. #4
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 640
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 640
    Points : 66 664
    Points
    66 664
    Billets dans le blog
    1
    Par défaut
    cela provient de la fonction generate_wysiwyg dans le fichier externe wysiwyg.js

    poste nous le code de cette fonction, on te dira quelle instruction ne passe pas ...

  5. #5
    Membre régulier
    Profil pro
    Inscrit en
    Septembre 2006
    Messages
    200
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2006
    Messages : 200
    Points : 73
    Points
    73
    Par défaut
    La fonction peut etre utilisé par les membres....elle fonctionne tres bien avec iexplorer....

    voici la focntion, c'est un open source que j'ai adapté a mon projet.
    voir la suite du code plus bas.......

    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
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    //
    // openWYSIWYG v1.01 Copyright (c) 2006 openWebWare.com
    // This copyright notice MUST stay intact for use.
    //
    // An open source WYSIWYG editor for use in web based applications.
    // For full source code and docs, visit http://www.openwebware.com/
    //
    // This library is free software; you can redistribute it and/or modify 
    // it under the terms of the GNU Lesser General Public License as published 
    // by the Free Software Foundation; either version 2.1 of the License, or 
    // (at your option) any later version.
    //
    // This library is distributed in the hope that it will be useful, but 
    // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
    // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
    // License for more details.
    //
    // You should have received a copy of the GNU Lesser General Public License along 
    // with this library; if not, write to the Free Software Foundation, Inc., 59 
    // Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     
     
    /* ---------------------------------------------------------------------- *\
      Global Variables: Set global variables such as images directory, 
    	                  WYSIWYG Height, Width, and CSS Directory.
    \* ---------------------------------------------------------------------- */
     
    // Images Directory
    imagesDir = "icons/";
     
    // CSS Directory
    cssDir = "styles/";
     
    // Popups Directory
    popupsDir = "popups/";
     
    // WYSIWYG Width and Height
    wysiwygWidth = 500;
    wysiwygHeight = 150;
     
    // Include Style Sheet
    document.write('<link rel="stylesheet" type="text/css" href="' +cssDir+ 'styles.css">\n');
     
     
    /* ---------------------------------------------------------------------- *\
      Toolbar Settings: Set the features and buttons available in the WYSIWYG
    	                  Toolbar.
    \* ---------------------------------------------------------------------- */
     
     
    // List of available font types
      var Fonts = new Array();
      Fonts[0] = "Arial";
      Fonts[1] = "Sans Serif";
      Fonts[2] = "Tahoma";
    	Fonts[3] = "Verdana";
    	Fonts[4] = "Courier New";
    	Fonts[5] = "Georgia";
    	Fonts[6] = "Times New Roman";
    	Fonts[7] = "Impact";
      Fonts[8] = "Comic Sans MS";
     
    // List of available block formats (not in use)
    var BlockFormats = new Array();
      BlockFormats[0]  = "Address";
      BlockFormats[1]  = "Bulleted List";
      BlockFormats[2]  = "Definition";
    	BlockFormats[3]  = "Definition Term";
    	BlockFormats[4]  = "Directory List";
    	BlockFormats[5]  = "Formatted";
    	BlockFormats[6]  = "Heading 1";
    	BlockFormats[7]  = "Heading 2";
    	BlockFormats[8]  = "Heading 3";
    	BlockFormats[9]  = "Heading 4";
    	BlockFormats[10] = "Heading 5";
    	BlockFormats[11] = "Heading 6";
    	BlockFormats[12] = "Menu List";
    	BlockFormats[13] = "Normal";
    	BlockFormats[14] = "Numbered List";
     
    // List of available font sizes
    var FontSizes = new Array();
      FontSizes[0]  = "1";
      FontSizes[1]  = "2";
      FontSizes[2]  = "3";
    	FontSizes[3]  = "4";
    	FontSizes[4]  = "5";
    	FontSizes[5]  = "6";
    	FontSizes[6]  = "7";
     
    // Order of available commands in toolbar one
    var buttonName = new Array();
      buttonName[0]  = "bold";
      buttonName[1]  = "italic";
      buttonName[2]  = "underline";
    	//buttonName[3]  = "strikethrough";
      buttonName[4]  = "seperator";
    	buttonName[5]  = "subscript";
    	buttonName[6]  = "superscript";
    	buttonName[7]  = "seperator";
    	buttonName[8]  = "justifyleft";
    	buttonName[9]  = "justifycenter";
    	buttonName[10] = "justifyright";
    	buttonName[11] = "seperator";
    	buttonName[12] = "unorderedlist";
    	buttonName[13] = "orderedlist";
    	buttonName[14] = "outdent";
    	buttonName[15] = "indent";
     
    // Order of available commands in toolbar two
    var buttonName2 = new Array();
      buttonName2[0]  = "forecolor";
    	buttonName2[1]  = "backcolor";
    	buttonName2[2]  = "seperator";
    	buttonName2[3]  = "cut";
    	buttonName2[4]  = "copy";
    	buttonName2[5]  = "paste";
    	buttonName2[6]  = "seperator";
      buttonName2[7]  = "undo";
    	buttonName2[8]  = "redo";
      buttonName2[9]  = "seperator";
    	buttonName2[10]  = "inserttable";
      buttonName2[11]  = "insertimage";
      buttonName2[12]  = "createlink";
    	buttonName2[13]  = "seperator";
    	buttonName2[14]  = "viewSource";
    	buttonName2[15]  = "seperator";
      buttonName2[16]  = "help";
     
    // List of available actions and their respective ID and images
    var ToolbarList = {
    //Name              buttonID                 buttonTitle           buttonImage                            buttonImageRollover
      "bold":           ['Bold',                 'Bold',               imagesDir + 'bold.gif',               imagesDir + 'bold_on.gif'],
      "italic":         ['Italic',               'Italic',             imagesDir + 'italics.gif',            imagesDir + 'italics_on.gif'],
      "underline":      ['Underline',            'Underline',          imagesDir + 'underline.gif',          imagesDir + 'underline_on.gif'],
    	"strikethrough":  ['Strikethrough',        'Strikethrough',      imagesDir + 'strikethrough.gif',      imagesDir + 'strikethrough_on.gif'],
    	"seperator":      ['',                     '',                   imagesDir + 'seperator.gif',          imagesDir + 'seperator.gif'],
    	"subscript":      ['Subscript',            'Subscript',          imagesDir + 'subscript.gif',          imagesDir + 'subscript_on.gif'],
    	"superscript":    ['Superscript',          'Superscript',        imagesDir + 'superscript.gif',        imagesDir + 'superscript_on.gif'],
    	"justifyleft":    ['Justifyleft',          'Justifyleft',        imagesDir + 'justify_left.gif',       imagesDir + 'justify_left_on.gif'],
    	"justifycenter":  ['Justifycenter',        'Justifycenter',      imagesDir + 'justify_center.gif',     imagesDir + 'justify_center_on.gif'],
    	"justifyright":   ['Justifyright',         'Justifyright',       imagesDir + 'justify_right.gif',      imagesDir + 'justify_right_on.gif'],
    	"unorderedlist":  ['InsertUnorderedList',  'InsertUnorderedList',imagesDir + 'list_unordered.gif',     imagesDir + 'list_unordered_on.gif'],
    	"orderedlist":    ['InsertOrderedList',    'InsertOrderedList',  imagesDir + 'list_ordered.gif',       imagesDir + 'list_ordered_on.gif'],
    	"outdent":        ['Outdent',              'Outdent',            imagesDir + 'indent_left.gif',        imagesDir + 'indent_left_on.gif'],
    	"indent":         ['Indent',               'Indent',             imagesDir + 'indent_right.gif',       imagesDir + 'indent_right_on.gif'],
    	"cut":            ['Cut',                  'Cut',                imagesDir + 'cut.gif',                imagesDir + 'cut_on.gif'],
    	"copy":           ['Copy',                 'Copy',               imagesDir + 'copy.gif',               imagesDir + 'copy_on.gif'],
      "paste":          ['Paste',                'Paste',              imagesDir + 'paste.gif',              imagesDir + 'paste_on.gif'],
    	"forecolor":      ['ForeColor',            'ForeColor',          imagesDir + 'forecolor.gif',          imagesDir + 'forecolor_on.gif'],
    	"backcolor":      ['BackColor',            'BackColor',          imagesDir + 'backcolor.gif',          imagesDir + 'backcolor_on.gif'],
    	"undo":           ['Undo',                 'Undo',               imagesDir + 'undo.gif',               imagesDir + 'undo_on.gif'],
    	"redo":           ['Redo',                 'Redo',               imagesDir + 'redo.gif',               imagesDir + 'redo_on.gif'],
    	"inserttable":    ['InsertTable',          'InsertTable',        imagesDir + 'insert_table.gif',       imagesDir + 'insert_table_on.gif'],
    	"insertimage":    ['InsertImage',          'InsertImage',        imagesDir + 'insert_picture.gif',     imagesDir + 'insert_picture_on.gif'],
    	"createlink":     ['CreateLink',           'CreateLink',         imagesDir + 'insert_hyperlink.gif',   imagesDir + 'insert_hyperlink_on.gif'],
    	"viewSource":     ['ViewSource',           'ViewSource',         imagesDir + 'view_source.gif',        imagesDir + 'view_source_on.gif'],
    	"viewText":       ['ViewText',             'ViewText',           imagesDir + 'view_text.gif',          imagesDir + 'view_text_on.gif'],
    	"help":           ['Help',                 'Help',               imagesDir + 'help.gif',               imagesDir + 'help_on.gif'],
    	"selectfont":     ['SelectFont',           'SelectFont',         imagesDir + 'select_font.gif',        imagesDir + 'select_font_on.gif'],
    	"selectsize":     ['SelectSize',           'SelectSize',         imagesDir + 'select_size.gif',        imagesDir + 'select_size_on.gif']
    };
     
     
     
    /* ---------------------------------------------------------------------- *\
      Function    : insertAdjacentHTML(), insertAdjacentText() and insertAdjacentElement()
      Description : Emulates insertAdjacentHTML(), insertAdjacentText() and 
    	              insertAdjacentElement() three functions so they work with 
    								Netscape 6/Mozilla
      Notes       : by Thor Larholm me@jscript.dk
    \* ---------------------------------------------------------------------- */
    if(typeof HTMLElement!="undefined" && !HTMLElement.prototype.insertAdjacentElement){
      HTMLElement.prototype.insertAdjacentElement = function
      (where,parsedNode)
    	{
    	  switch (where){
    		case 'beforeBegin':
    			this.parentNode.insertBefore(parsedNode,this)
    			break;
    		case 'afterBegin':
    			this.insertBefore(parsedNode,this.firstChild);
    			break;
    		case 'beforeEnd':
    			this.appendChild(parsedNode);
    			break;
    		case 'afterEnd':
    			if (this.nextSibling) 
          this.parentNode.insertBefore(parsedNode,this.nextSibling);
    			else this.parentNode.appendChild(parsedNode);
    			break;
    		}
    	}
     
    	HTMLElement.prototype.insertAdjacentHTML = function
      (where,htmlStr)
    	{
    		var r = this.ownerDocument.createRange();
    		r.setStartBefore(this);
    		var parsedHTML = r.createContextualFragment(htmlStr);
    		this.insertAdjacentElement(where,parsedHTML)
    	}
     
     
    	HTMLElement.prototype.insertAdjacentText = function
      (where,txtStr)
    	{
    		var parsedText = document.createTextNode(txtStr)
    		this.insertAdjacentElement(where,parsedText)
    	}
    };
     
     
    // Create viewTextMode global variable and set to 0
    // enabling all toolbar commands while in HTML mode
    viewTextMode = 0;
     
     
     
    /* ---------------------------------------------------------------------- *\
      Function    : generate_wysiwyg()
      Description : replace textarea with wysiwyg editor
      Usage       : generate_wysiwyg("textarea_id");
      Arguments   : textarea_id - ID of textarea to replace
    \* ---------------------------------------------------------------------- */
    function generate_wysiwyg(textareaID) {
     
      	// Hide the textarea 
    	document.getElementById(textareaID).style.display = 'none'; 
     
      // Pass the textareaID to the "n" variable.
      var n = textareaID;
     
    	// Toolbars width is 2 pixels wider than the wysiwygs
    	toolbarWidth = parseFloat(wysiwygWidth) + 2;
     
      // Generate WYSIWYG toolbar one
      var toolbar;
      toolbar =  '<table cellpadding="0" cellspacing="0" border="0" class="toolbar1" style="width:' + toolbarWidth + 'px;"><tr><td style="width: 6px;"><img src="' +imagesDir+ 'seperator2.gif" alt="" hspace="3"></td>';
     
    	// Create IDs for inserting Font Type and Size drop downs
    	toolbar += '<td style="width: 90px;"><span id="FontSelect' + n + '"></span></td>';
    	toolbar += '<td style="width: 60px;"><span id="FontSizes'  + n + '"></span></td>';
     
    	// Output all command buttons that belong to toolbar one
    	for (var i = 0; i <= buttonName.length;) { 
        if (buttonName[i]) {
    	    var buttonObj            = ToolbarList[buttonName[i]];
    		  var buttonID             = buttonObj[0];
    	    var buttonTitle          = buttonObj[1];
          var buttonImage          = buttonObj[2];
    		  var buttonImageRollover  = buttonObj[3];
     
    			if (buttonName[i] == "seperator") {
    		    toolbar += '<td style="width: 12px;" align="center"><img src="' +buttonImage+ '" border=0 unselectable="on" width="2" height="18" hspace="2" unselectable="on"></td>';
    			}
    	    else {
    		    toolbar += '<td style="width: 22px;"><img src="' +buttonImage+ '" border=0 unselectable="on" title="' +buttonTitle+ '" id="' +buttonID+ '" class="button" onClick="formatText(this.id,\'' + n + '\');" onmouseover="if(className==\'button\'){className=\'buttonOver\'}; this.src=\'' + buttonImageRollover + '\';" onmouseout="if(className==\'buttonOver\'){className=\'button\'}; this.src=\'' + buttonImage + '\';" unselectable="on" width="20" height="20"></td>';
    	    }
        }
        i++;
      }
     
      toolbar += '<td>&nbsp;</td></tr></table>';  
     
      // Generate WYSIWYG toolbar two
      var toolbar2;
      toolbar2 = '<table cellpadding="0" cellspacing="0" border="0" class="toolbar2" style="width:' + toolbarWidth + 'px;"><tr><td style="width: 6px;"><img src="' +imagesDir+ 'seperator2.gif" alt="" hspace="3"></td>';
     
      // Output all command buttons that belong to toolbar two
      for (var j = 0; j <= buttonName2.length;) {
        if (buttonName2[j]) {
    	    var buttonObj            = ToolbarList[buttonName2[j]];
    		var buttonID             = buttonObj[0];
    	    var buttonTitle          = buttonObj[1];
          	var buttonImage          = buttonObj[2];
    		var buttonImageRollover  = buttonObj[3];
     
    		  if (buttonName2[j] == "seperator") {
    		    toolbar2 += '<td style="width: 12px;" align="center"><img src="' +buttonImage+ '" border=0 unselectable="on" width="2" height="18" hspace="2" unselectable="on"></td>';
    			}
    	    else if (buttonName2[j] == "viewSource"){
    		    toolbar2 += '<td style="width: 22px;">';
    				toolbar2 += '<span id="HTMLMode' + n + '"><img src="'  +buttonImage+  '" border=0 unselectable="on" title="' +buttonTitle+ '" id="' +buttonID+ '" class="button" onClick="formatText(this.id,\'' + n + '\');" onmouseover="if(className==\'button\'){className=\'buttonOver\'}; this.src=\'' +buttonImageRollover+ '\';" onmouseout="if(className==\'buttonOver\'){className=\'button\'}; this.src=\'' + buttonImage + '\';" unselectable="on"  width="20" height="20"></span>';
    				toolbar2 += '<span id="textMode' + n + '"><img src="' +imagesDir+ 'view_text.gif" border=0 unselectable="on" title="viewText"          id="ViewText"       class="button" onClick="formatText(this.id,\'' + n + '\');" onmouseover="if(className==\'button\'){className=\'buttonOver\'}; this.src=\'' +imagesDir+ 'view_text_on.gif\';"    onmouseout="if(className==\'buttonOver\'){className=\'button\'}; this.src=\'' +imagesDir+ 'view_text.gif\';" unselectable="on"  width="20" height="20"></span>';
    	      toolbar2 += '</td>';
    			}
    	    else {
    		    toolbar2 += '<td style="width: 22px;"><img src="' +buttonImage+ '" border=0 unselectable="on" title="' +buttonTitle+ '" id="' +buttonID+ '" class="button" onClick="formatText(this.id,\'' + n + '\');" onmouseover="if(className==\'button\'){className=\'buttonOver\'}; this.src=\'' +buttonImageRollover+ '\';" onmouseout="if(className==\'buttonOver\'){className=\'button\'}; this.src=\'' + buttonImage + '\';" unselectable="on" width="20" height="20"></td>';
    	    }
        }
        j++;
      }
     
      toolbar2 += '<td>&nbsp;</td></tr></table>';  
     
     
    	// Create iframe which will be used for rich text editing
    	var iframe = '<table cellpadding="0" cellspacing="0" border="0" style="width:' + wysiwygWidth + 'px; height:' + wysiwygHeight + 'px;border: 1px inset #CCCCCC;"><tr><td valign="top">\n'
      + '<iframe frameborder="0" id="wysiwyg' + n + '"></iframe>\n'
      + '</td></tr></table>\n';
     
      // Insert after the textArea both toolbar one and two
      document.getElementById(n).insertAdjacentHTML("afterEnd", toolbar + toolbar2 + iframe);
     
      // Insert the Font Type and Size drop downs into the toolbar
    	outputFontSelect(n);
    	outputFontSizes(n); 
     
      // Hide the dynamic drop down lists for the Font Types and Sizes
      hideFonts(n);
    	hideFontSizes(n);
     
    	// Hide the "Text Mode" button
    	document.getElementById("textMode" + n).style.display = 'none'; 
     
    	// Give the iframe the global wysiwyg height and width
      document.getElementById("wysiwyg" + n).style.height = wysiwygHeight + "px";
      document.getElementById("wysiwyg" + n).style.width = wysiwygWidth + "px";
     
    	// Pass the textarea's existing text over to the content variable
      var content = document.getElementById(n).value;
     
    	var doc = document.getElementById("wysiwyg" + n).contentWindow.document;
     
    	// Write the textarea's content into the iframe
      doc.open();
      doc.write(content);
      doc.close();
     
    	// Make the iframe editable in both Mozilla and IE
      doc.body.contentEditable = true;
      doc.designMode = "on";
     
      	// Update the textarea with content in WYSIWYG when user submits form
      var browserName = navigator.appName;
      if (browserName == "Microsoft Internet Explorer") {
        for (var idx=0; idx < document.forms.length; idx++) {
          document.forms[idx].attachEvent('onsubmit', function() { updateTextArea(n); });
        }
      }
      else {
      	for (var idx=0; idx < document.forms.length; idx++) {
        	document.forms[idx].addEventListener('submit',function OnSumbmit() { updateTextArea(n); }, true);
        }
      }
     
     
    };

  6. #6
    Membre régulier
    Profil pro
    Inscrit en
    Septembre 2006
    Messages
    200
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2006
    Messages : 200
    Points : 73
    Points
    73
    Par défaut
    suite du code:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
     
     
    /* ---------------------------------------------------------------------- *\
      Function    : updateTextArea()
      Description : Updates the text area value with the HTML source of the WYSIWYG
      Usage       : updateTextArea(n)
      Arguments   : n   - The editor identifier (the textarea's ID)
    \* ---------------------------------------------------------------------- */
    function updateTextArea(n) {
      document.getElementById(n).value = document.getElementById("wysiwyg" + n).contentWindow.document.body.innerHTML;
    };

  7. #7
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 640
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 640
    Points : 66 664
    Points
    66 664
    Billets dans le blog
    1
    Par défaut
    Ha oui c'est pas de la fonction de fillette ...

    et que te retourne comme erreur la console firefox ?
    ça évitera de chercher pendant des heures ...

  8. #8
    Membre régulier
    Profil pro
    Inscrit en
    Septembre 2006
    Messages
    200
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2006
    Messages : 200
    Points : 73
    Points
    73
    Par défaut
    c'est pas vraiment une erreur, mais plustot pas d'affichage de l'outil de mise en forme. je l'ai bien indiqué dans l'image attachée au premier message...
    merci,

  9. #9
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 640
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 640
    Points : 66 664
    Points
    66 664
    Billets dans le blog
    1
    Par défaut
    la console doit forcément signaler une erreur ...

  10. #10
    Membre régulier
    Profil pro
    Inscrit en
    Septembre 2006
    Messages
    200
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2006
    Messages : 200
    Points : 73
    Points
    73
    Par défaut
    La console ne signale aucune erreur....><html:textarea s'affiche sans la barre d'outil avec le browser mozilla par contre sa fonctionne bien avec iexplorer.... comme indiqué sur l'image
    Images attachées Images attachées  

Discussions similaires

  1. VBA: Erreur d'affichage listbox avec valeur unique
    Par polenade dans le forum Macros et VBA Excel
    Réponses: 2
    Dernier message: 24/07/2012, 19h34
  2. Principe fonctionnement éditeur WYSIWYG avec iFrame
    Par Sanceray3 dans le forum Bibliothèques & Frameworks
    Réponses: 3
    Dernier message: 21/03/2010, 00h23
  3. Réponses: 2
    Dernier message: 27/06/2009, 12h49
  4. Erreurs d'affichage d'un menu CSS avec IE7
    Par randotcom dans le forum Mise en page CSS
    Réponses: 2
    Dernier message: 26/04/2009, 07h47

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