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 :

[AJAX] Page précédente avec Ajax


Sujet :

JavaScript

  1. #1
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    2
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2008
    Messages : 2
    Points : 1
    Points
    1
    Par défaut [AJAX] Page précédente avec Ajax
    Bonjour à tous,

    Je suis en train de reprendre un fichier .js que vous pouvez voir à l'adresse suivante http://mbo.idetop-project.com/index....e=portefeuille

    Sauf que les liens suivants et précédents ne marchent pas, pouvez vous m'aider svp

    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
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    var Portefeuille = {
    	repertoire_install: '',
    	tab_open: -1,
    	mode: 'complexe',
    	color: new Array('#00C2FF', '#FF5800', '#FFA401'),
    	nb_fiche_tab: new Array(0, 0, 0),
    	fiche_tab_open: new Array(0, 0, 0),
    	first_fiche : new Array(0,0,0),
    	list_field: new Array(),
    	type: '',
    	tableau_fiches: new Array(),
    	init: function(repertoire, type_user, fiche_to_open) {
    		Portefeuille.type = type_user;
    		Portefeuille.repertoire_install = repertoire;
    		var dp = document.getElementById('portefeuille');
    		dp.innerHTML = 	'<div id="portefeuille_top">' +
    						'<a href="#" onclick="Portefeuille.switchMode(\'complexe\')"><img src="' + repertoire + '/images/ttabs/tab_1.gif" border="0" /></a>' +
    						'<a href="#" onclick="Portefeuille.switchMode(\'liste\')"><img src="' + repertoire + '/images/ttabs/tab_2.gif" border="0" /></a>' +
    						'</div>' +
    						'<div id="portefeuille_complexe">' +
    							'<div id="portefeuille_form">' +
    								'<table cellpadding="0" cellspacing="0" border="0" width="100%" style="background-color:#88909D">' +
    									'<tr>' +
    										'<td style="background:url(\'' + repertoire + '/images/form/img.jpg\') repeat-x bottom; height:620px;" align="center">' +
    										'<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><form method="post" action="#" name="portefeuille_formulaire_form">' +
    												'<div id="portefeuille_formulaire" style="text-align:center; width:auto;"></div>' +
    												//'<!--<br/><a href="#" onclick="Portefeuille.valideForm()"><img src="' + repertoire + '/images/form/ok.jpg" border="0" alt="ok" /></a>-->'  +
    											'</form>' +
    										'</td>' +
    									'</tr>' +
    								'</table>' +
    							'</div>' +
     
    							'<div id="portefeuille_fiches"></div>' +
     
    							'<div id="portefeuille_tabs"></div>' +
    							'<div id="loader" align="center" display="none"><br/><img src="' + repertoire + '/images/form/loader_mbo.gif" border="0" alt="loading ..." width="200px" /></div>' +
    						'</div>' +
    						'<div id="portefeuille_liste">' +
    							'<img src="' + Portefeuille.repertoire_install + '/images/liste/top.jpg" alt="" /><br />' +
    							'<a href="catalogue.pdf" target="_blank"><img src="' + Portefeuille.repertoire_install + '/images/fiche/telecharger_pdf.jpg" alt="imprimer" border="0" /></a>&nbsp;&nbsp;&nbsp;&nbsp;' +
    							'<a href="#port" onclick="Portefeuille.alpha();return false;" style="color:#00ACDE; text-decoration:none; font-size:16px;"><img src="' + Portefeuille.repertoire_install + '/images/liste/classer_alpha.jpg" alt="Classer par ordre alphabétique" border="0" /></a>&nbsp;&nbsp;&nbsp;&nbsp;' +
    							'<a href="#port" onclick="Portefeuille.populate();return false;" style="color:#00ACDE; text-decoration:none; font-size:16px;"><img src="' + Portefeuille.repertoire_install + '/images/liste/classer_date.jpg" alt="classer par date" border="0" /></a>' +
    //							'<form method="post" action="#" name="portefeuille_liste_formulaire_form">' +
    //								'<table border="0" cellspacing="0" cellpadding="0">' +
    //									'<tr>' +
    //										'<td><div id="portefeuille_liste_form" style="width:auto;"></div></td>' +
    //										'<td><a href="#" onclick="Portefeuille.valideFormListe()"><img src="' + repertoire + '/images/liste/ok.jpg" border="0" alt="ok" /></a></td>' +
    //										'<td align="center" valign="middle"><a href="#" onclick="Portefeuille.listePrint()"><img src="' + Portefeuille.repertoire_install + '/images/liste/print.jpg" alt="imprimer" border="0" /></a></td>' +
    //									'</tr>' +
    //								'</table>' +
    //							'</form>' +
    							'<table cellpadding="0" cellspacing="0" border="0">' +
    							'<tr>' +
    								'<td align="center" width="60" style="background-color:#606060; color:#FFFFFF;">Date</td>' +
    								'<td align="center"><img src="' + Portefeuille.repertoire_install + '/images/pixel.gif" alt ="" width="2" /></td>' +
    								'<td align="center" width="120" style="background-color:#606060; color:#FFFFFF;">Logo</td>' +
    								'<td align="center"><img src="' + Portefeuille.repertoire_install + '/images/pixel.gif" alt ="" width="2" /></td>' +
    								'<td align="center" width="100" style="background-color:#606060; color:#FFFFFF;">Société</td>' +
    								'<td align="center"><img src="' + Portefeuille.repertoire_install + '/images/pixel.gif" alt ="" width="2" /></td>' +
    								'<td align="center" width="26" style="background-color:#606060; color:#FFFFFF;">Dpt</td>' +
    								'<td align="center"><img src="' + Portefeuille.repertoire_install + '/images/pixel.gif" alt ="" width="2" /></td>' +
    								'<td align="center" width="270" style="background-color:#606060; color:#FFFFFF;">Activité</td>' +
    								'<td align="center"><img src="' + Portefeuille.repertoire_install + '/images/pixel.gif" alt ="" width="2" /></td>' +
    								'<td align="center" width="60" style="background-color:#606060; color:#FFFFFF;">CA en M€</td>' +
    								'<td align="center"><img src="' + Portefeuille.repertoire_install + '/images/pixel.gif" alt ="" width="2" /></td>' +
    								'<td align="center" width="40" style="background-color:#606060; color:#FFFFFF;">News</td>' +
    								'<td align="center"><img src="' + Portefeuille.repertoire_install + '/images/pixel.gif" alt ="" width="2" /></td>' +
    								'<td align="center" width="50" style="background-color:#606060; color:#FFFFFF;">Site web</td>' +
    							'</tr>' +
    							'</table>' +
    							'<div id="portefeuille_liste_table" style="overflow:auto; height:400px;"></div>' +
    						'</div>';
    		var dpf = document.getElementById('portefeuille_fiches');
    		var dpt = document.getElementById('portefeuille_tabs');
    		document.getElementById('loader').style.display = 'none';
     
    		for (var i = 0; i < 3; i++) {
    			dpf.innerHTML += '<div id="fiche_' + i + '" class="portefeuille_fiche" style="display:none; background:url(\'' + Portefeuille.repertoire_install + '/images/bg.gif\');"></div>';
    			dpt.innerHTML += '<a id="a_fiche_' + i + '" href="#" onclick="javascript:Portefeuille.open(\'' + i + '\')"><img id="img_fiche_' + i + '" src="' + repertoire + '/images/rtabs/' + Portefeuille.type + '/tab_' + i + '_off.gif" border="0" /></a>';
    		}
    		Portefeuille.setForm();
    		document.getElementById('loader').style.display = 'block';
    		Portefeuille.populate('', fiche_to_open);
     
    	},
    	setForm: function () {
    		var xhr = null; 
    	 	if(window.XMLHttpRequest)
    	   		xhr = new XMLHttpRequest(); 
    		else if(window.ActiveXObject){ 
    	   		try {
                    xhr = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                    xhr = new ActiveXObject("Microsoft.XMLHTTP");
                }
    		}
    		else { 
    		   xhr = false; 
    		}
    		xhr.onreadystatechange = function() {
    			if (xhr.readyState == 4 && xhr.status == 200) {
    				var reponse = xhr_clean(xhr.responseXML.documentElement);
    				var string = '';
    				var string2 = '';
    				var champs = reponse.getElementsByTagName("champ");
    				for (var i = 0; i < champs.length	; i++) {
    					Portefeuille.list_field.push(champs[i].childNodes[0].firstChild.nodeValue);
    					string += '<select name="' + champs[i].childNodes[0].firstChild.nodeValue + '" id="p_f_' + champs[i].childNodes[0].firstChild.nodeValue + '" style="width:250px; font-size:10px;" onchange="window.location.href=\'?page=portefeuille&fiche=\' + this.value">';
    					string2 += '<select name="' + champs[i].childNodes[0].firstChild.nodeValue + '" id="p_f_l_' + champs[i].childNodes[0].firstChild.nodeValue + '">';
    					var values = champs[i].childNodes[1];
    					for (var j = 0; j < values.childNodes.length; j++) {
    						string += '<option value="' + values.childNodes[j].getAttribute('val') + '">' + values.childNodes[j].getAttribute('title') + '</option>';
    						string2 += '<option value="' + values.childNodes[j].getAttribute('val') + '">' + values.childNodes[j].getAttribute('title') + '</option>';
    					}
    					string += '</select><br />';
    					string2 += '</select>&nbsp;';
    				}
    				var dpf = document.getElementById('portefeuille_formulaire');
    				dpf.innerHTML = string;
    				//var dpf2 = document.getElementById('portefeuille_liste_form');
    				//dpf2.innerHTML = string2;
    			}
    		}
    		xhr.open("GET", Portefeuille.repertoire_install + "/forms.xml.php", true);
    		xhr.send(null);
    		document.getElementById('loader').style.display = 'none';
    	},
    	valideForm: function () {
    		var string = '';
    		for (var i =0; i < Portefeuille.list_field.length; i++) {
    			var el = Portefeuille.list_field[i];
    			var sel = document.getElementById('p_f_' + el);
    			var val = sel.options[sel.selectedIndex].value;
    			string += el + '=' + val + '&';
    		}
    		Portefeuille.populate(string);
    		document.getElementById('loader').style.display = 'block';
    	},
    	valideFormListe: function () {
    		var string = '';
    		for (var i =0; i < Portefeuille.list_field.length; i++) {
    			var el = Portefeuille.list_field[i];
    			var sel = document.getElementById('p_f_l_' + el);
    			var val = sel.options[sel.selectedIndex].value;
    			string += el + '=' + val + '&';
    		}
    		Portefeuille.populate(string);
    	},
    	open: function(num_tab) {
    		if (Portefeuille.tab_open != -1) {
    			Portefeuille.close();
    		}
    		//var f = document.getElementById('fiche_' + num_tab);
    		//f.style.display = 'block';
    		Effect.SlideLeft('fiche_' + num_tab);
    		Portefeuille.tab_open = num_tab;
    		document.getElementById('loader').style.display = 'none';
    	},
    	close: function () {
    		var num_tab = Portefeuille.tab_open;
    		var f = document.getElementById('fiche_' + num_tab);
    		f.style.display = 'none';
    		document.getElementById('loader').style.display = 'block';
    //		Effect.SlideRight('fiche_' + num_tab);
    	},
    	populate: function (params, fiche_to_open) {
    		for (var i = 0; i < Portefeuille.nb_fiche_tab.length; i++) {
    			var dpf = document.getElementById('fiche_' + i);
    			dpf.innerHTML = "";
    			Portefeuille.fiche_tab_open[i] = 0;
    		}
     
    		var xhr = null; 
    	 	if(window.XMLHttpRequest)
    	   		xhr = new XMLHttpRequest(); 
    		else if(window.ActiveXObject){ 
    	   		try {
                    xhr = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                    xhr = new ActiveXObject("Microsoft.XMLHTTP");
                }
    		}
    		else { 
    		   xhr = false; 
    		}
    		xhr.onreadystatechange = function() {
    			if (xhr.readyState == 4 && xhr.status == 200) {
    				var reponse = xhr_clean(xhr.responseXML.documentElement);
    				var fiches = reponse.getElementsByTagName("fiche");
    				var string = '<table cellpadding="0" cellspacing="0" border="0">';
    				string += 	'<tr>' +
     
    							'</tr>';
     
    				for (var j = 0; j < fiches.length; j++) {
    					Portefeuille.createFiche(fiches[j], fiches.length);
    					string += Portefeuille.createLine(fiches[j]);
    				}
    				string += '</table>';
    				for (var i = 0; i < Portefeuille.nb_fiche_tab.length; i++) {
    					var dpf = document.getElementById('fiche_' + i);
    					if (dpf.innerHTML == "") {
    						dpf.innerHTML = '<div style="width:100%; height: 623px;">&nbsp;</div>';
    					}
    				}
    				var dp = document.getElementById('portefeuille_liste_table');
    				dp.innerHTML = string;
    				if (fiche_to_open !== false) {
    					fiche_to_open = false;
    					Portefeuille.dispFiche(fiche_to_open);
    				}	
    			}
    		}
    		xhr.open("GET", Portefeuille.repertoire_install + "/populate.xml.php?portefeuille=" + Portefeuille.type + (params != '' ? '&' + params : ''), true);
    		xhr.send(null);
    	},
    	createFiche: function (xml_data, nbfiches) {
    		// définition du template
    		var _nom_societe = xml_data.childNodes[0].firstChild.nodeValue;
    		var _date = xml_data.childNodes[1].firstChild.nodeValue;
    		var _ca = xml_data.childNodes[2].firstChild.nodeValue;
    		var _annee_ca = xml_data.childNodes[3].firstChild.nodeValue;
    		var _nom_dirigeant = xml_data.childNodes[4].firstChild.nodeValue;
    		var _departement = xml_data.childNodes[5].firstChild.nodeValue;
    		var __news = xml_data.childNodes[6];
    		var _news = '';
    		for (var i = 0; i < __news.childNodes.length; i++) {
    			_news += __news.childNodes[i].nodeValue;
    		}
    		var _site_web = xml_data.childNodes[7].firstChild.nodeValue;
    		var _logo = xml_data.childNodes[8].firstChild.nodeValue;
    		var _photo = xml_data.childNodes[9].firstChild.nodeValue;
    		var _operation = xml_data.childNodes[10].firstChild.nodeValue;
    		var _region = xml_data.childNodes[11].firstChild.nodeValue;
    		var _activite = xml_data.childNodes[12].firstChild.nodeValue;
    		var _id_bdd = xml_data.childNodes[13].firstChild.nodeValue;
    		var _titre = xml_data.childNodes[14].firstChild.nodeValue;
     
    		var _onglet = xml_data.childNodes[16].firstChild.nodeValue;
    		var id = xml_data.childNodes[17].firstChild.nodeValue;
     
    		var __mois = new Array('', 'Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'); 
    		var _date_mois = _date.substring(3, 5);
    		if (_date_mois.substring(0, 1) == 0)
    			_date_mois = _date_mois.substring(1, 2);
    		var _mois = __mois[_date_mois];
    		var _date_annee = _date.substring(6, 10);
    		var color = Portefeuille.color[_onglet];
     
    		var __temp = new Array();
    		__temp.id_bdd = _id_bdd;
    		__temp.onglet = _onglet;
    		__temp.id = id; 
     
     
    		if (Portefeuille.first_fiche[_onglet] == 0) {
    			Portefeuille.first_fiche[_onglet] = _id_bdd;
    		}
     
    		Portefeuille.tableau_fiches.push(__temp);
     
    		var html_tpl = 	'<div id="' + _id_bdd + '_' +  _onglet + '" style="display:'+ (id == 0 ? 'block' : 'none') + ';"><div id="fiche_entreprise_' + _onglet + '_' + id + '" style="background-color:#FFFFFF;font-family:Arial, Verdana, sans-serif; font-size:10px; border-right:1px solid ' + color +'; border-bottom:1px solid ' + color +'; ">' +
    						'<table width="100%" cellpadding="0" cellspacing="0" border="0">' +
    							'<tr>' +
    								'<td width="3" style="background-color:' + color + '" rowspan="2">&nbsp;</td>' +
    								'<td>' +
    									'<table width="100%" cellpadding="0" cellspacing="0" border="0">' +
    										'<tr>' +
    											'<td style="background-color:' + color + '; color: #FFFFFF">' +
    												'&nbsp;' + _nom_societe +
    											'</td>' +
    											'<td style="background-color:#606060; color: #FFFFFF">' +
    												'&nbsp;' + _date.substring(3, 10) +
    											'</td>' +
    										'</tr>' +
    									'</table>' +
    								'</td>' +
    							'</tr>' +
    							'<tr>' +
    								'<td>' +
    									'<div style="padding-left:10px;">' +
    										'<table width="100%" cellpadding="0" cellspacing="0" border="0">' +
    										'<tr>' +
    											'<td valign="bottom" align="left" style="height: 165px;">';
    		if (_photo != "") {
    			html_tpl += 					'<table width="100%" cellspacing="0" cellpadding="0" border="0">' +
    												'<tr>' +
    													'<td><img src="' + _photo + '" /></td>' +
    													'<td align="left" valign="bottom">' +
    														(_logo != "" ? '<img src="' + _logo + '" /><br />' : _nom_societe + '<br />') +
    														'<span style="color:' + color + '">&bull;</span> CA ' + _annee_ca + ' : ' + _ca + " M€<br />" +
    														'<span style="color:' + color + '">&bull;</span> ' + _mois + ' ' + _date_annee + "<br />" +
    														'<span style="color:' + color + '">&bull;</span> ' + _nom_dirigeant + "<br />" +
    														'<span style="color:' + color + '">&bull;</span> Département : ' + _departement + "<br />" +
    														'<span style="color:' + color + '">&bull;</span> Site Web : <a href="http://' + _site_web + '" target="blank">'+ _site_web + '</a><br />' +
    													'</td>' +
    												'</tr>' +
    											'</table>';
    		}
    		else {
    			html_tpl += 					'' +
    											(_logo != "" ? '<img src="' + _logo + '" /><br />' : _nom_societe + '<br />') +
    											'<span style="color:' + color + '">&bull;</span> CA ' + _annee_ca + ' : ' + _ca + " M€<br />" +
    											'<span style="color:' + color + '">&bull;</span> ' + _mois + ' ' + _date_annee + "<br />" +
    											'<span style="color:' + color + '">&bull;</span> ' + _nom_dirigeant + "<br />" +
    											'<span style="color:' + color + '">&bull;</span> Département : ' + _departement + "<br />" +
    											'<span style="color:' + color + '">&bull;</span> Site Web : <a href="http://' + _site_web + '" target="blank">'+ _site_web + '</a><br />' +
    											'';
    		}
    		html_tpl += 							'</td>' +
    											'</tr>' +
    											'<tr>' +
    												'<td style="height: 29px;" align="center"><img src="' + Portefeuille.repertoire_install + '/images/fiche/sep.jpg" alt="" />' +
    											'</tr>' +
    											'<tr>' +
    												'<td style="height: 310px;"><div style="height:310px; overflow:auto; padding-right:5px;" align="justify"><br /><b>' + _titre + '</b><br />' + _news + '</div></td>' +
    											'</tr>' +
    											'<tr>' +
    												'<td style="height: 29px;" align="center"><img src="' + Portefeuille.repertoire_install + '/images/fiche/sep.jpg" alt="" />' +
    											'</tr>' +
    											'<tr>' +
    												'<td style="height: 60px;" valign="middle">' +
    													'<div id="print_session">' +
    													'<table width="100%" cellpadding="0" cellspacing="0" border="0">' +
    														'<tr>' +
    															'<td align="center" valign="middle" width="33%">';
    															if (id!=0) {
    																html_tpl += '<a href="#port" onclick="Portefeuille.fichePrec()" style="font-weight: bold; font-size: 12px; text-decoration:none; ">Affaire suivante</a>';
    															} else {
    																html_tpl += '&nbsp;';
    															}
    															html_tpl += '</td>' +
    															'<td align="center" valign="middle" width="33%"><a href="#port" onclick="Portefeuille.fichePrint(\'fiche_entreprise_' + _onglet + '_' + id + '\')"><img src="' + Portefeuille.repertoire_install + '/images/fiche/imprimer.jpg" alt="imprimer" border="0" /></a></td>' +
    															'<td align="center" valign="middle" width="33%">';
    															if (parseInt(id)+1 > parseInt(nbfiches) ) {
    																alert('ID : ' + id + ' - nbfiches : ' + nbfiches);
    																html_tpl += '<a href="#port" onclick="Portefeuille.ficheSuiv()">Affaire précédente</a>';
    															} else {
    																html_tpl +=	'<a href="#port" onclick="Portefeuille.ficheSuiv()" style="font-weight: bold; font-size: 12px; text-decoration:none; ">Affaire précédente </a>';
    															}
    															html_tpl += '</td>' +
    														'</tr>' +
    													'</table>' +
    													'</div>' +
    												'</td>' +
    											'</tr>' +
    										'</table>' +
    									'</div>' +
    								'</td>' +
    							'</tr>' +
    						'</table>' +
    						'</div>' + 
    						'</div>';
    		Portefeuille.nb_fiche_tab[_onglet] = id;
    		var f = document.getElementById('fiche_' + _onglet);
    		f.innerHTML += html_tpl;
    	},
    	createLine: function (xml_data) {
    		// définition du template
    		var _nom_societe = xml_data.childNodes[0].firstChild.nodeValue;
    		var _date = xml_data.childNodes[1].firstChild.nodeValue;
    		var _ca = xml_data.childNodes[2].firstChild.nodeValue;
    		var _annee_ca = xml_data.childNodes[3].firstChild.nodeValue;
    		var _nom_dirigeant = xml_data.childNodes[4].firstChild.nodeValue;
    		var _departement = xml_data.childNodes[5].firstChild.nodeValue;
    		var __news = xml_data.childNodes[6];
    		var _news = '';
    		for (var i = 0; i < __news.childNodes.length; i++) {
    			_news += __news.childNodes[i].nodeValue;
    		}
    		var _site_web = xml_data.childNodes[7].firstChild.nodeValue;
    		var _logo = xml_data.childNodes[8].firstChild.nodeValue;
    		var _activite = xml_data.childNodes[12].firstChild.nodeValue;
    		var _id_bdd = xml_data.childNodes[13].firstChild.nodeValue;
    		var _titre = xml_data.childNodes[14].firstChild.nodeValue;
     
    		var _onglet = xml_data.childNodes[15].firstChild.nodeValue;
    		var id = xml_data.childNodes[16].firstChild.nodeValue;
     
    		var _date_mois = _date.substring(3, 5);
    		var _date_annee = _date.substring(6, 10);
     
    		if (_onglet != "3") {
     
    		var html_tpl = 	'<tr>' +
    							'<td width="60" align="center" style="height:80px; border-bottom: 1px dotted #606060;">' + _date_mois + '/' + _date_annee + '</td>' +
    							'<td align="center" style="border-bottom: 1px dotted #606060;"><img src="' + Portefeuille.repertoire_install + '/images/pixel.gif" alt ="" width="2" /></td>' +
    							'<td width="120" align="center" style="border-bottom: 1px dotted #606060;">' +
    							(_logo != "" ? '<img src="' + _logo + '" alt="' + _nom_societe + '" /><br />' : _nom_societe + '<br />') + '</td>' +
    							'<td align="center" style="border-bottom: 1px dotted #606060;"><img src="' + Portefeuille.repertoire_install + '/images/pixel.gif" alt ="" width="2" /></td>' +
    							'<td width="100" align="center" style="border-bottom: 1px dotted #606060;">' + _nom_societe + '</td>' +
    							'<td align="center" style="border-bottom: 1px dotted #606060;"><img src="' + Portefeuille.repertoire_install + '/images/pixel.gif" alt ="" width="2" /></td>' +
    							'<td width="26" align="center" style="border-bottom: 1px dotted #606060;">' + _departement + '</td>' +
    							'<td align="center" style="border-bottom: 1px dotted #606060;"><img src="' + Portefeuille.repertoire_install + '/images/pixel.gif" alt ="" width="2" /></td>' +
    							'<td width="270" align="left" style="border-bottom: 1px dotted #606060;">' + 	_activite + 	'</td>' +
    							'<td align="center" style="border-bottom: 1px dotted #606060;"><img src="' + Portefeuille.repertoire_install + '/images/pixel.gif" alt ="" width="2" /></td>' +
    							'<td width="60" align="center" style="border-bottom: 1px dotted #606060;">' + _ca + '</td>' +
    							'<td align="center" style="border-bottom: 1px dotted #606060;"><img src="' + Portefeuille.repertoire_install + '/images/pixel.gif" alt ="" width="2" /></td>' +
    							'<td width="40" align="center" style="border-bottom: 1px dotted #606060;"><a href="#" onclick="Portefeuille.displayNews(\'portefeuille_news_' + _id_bdd + '\')">	<img src="' + Portefeuille.repertoire_install + '/images/liste/news.jpg" alt="news" border="0" /></a><div id="portefeuille_news_' + _id_bdd + '" style="position:absolute; display:none; width: 50 %; top: 20px; left: 25%; border: 1px solid #606060; background-color:#FFFFFF; text-align:left; padding:10px;"><b>' + _titre + 	'</b><br />' + _news + '<br /><div style="width:100%; text-align:center;"><a href="#" onclick="Portefeuille.closeNews(\'portefeuille_news_' + _id_bdd + '\'); return false;">Fermer</a></div></div></td>' +
    							'<td align="center" style="border-bottom: 1px dotted #606060;"><img src="' + Portefeuille.repertoire_install + '/images/pixel.gif" alt ="" width="2" /></td>' +
    							'<td width="50" align="center" style="border-bottom: 1px dotted #606060;"><a href="http://' + _site_web + '" target="_blank"><img src="' + Portefeuille.repertoire_install + '/images/liste/fleche.jpg" alt="&gt;" border="0" /></a></td>' +
    						'</tr>';	
    		}
    		else {
    				var html_tpl = "";
    		}
    		return html_tpl;
    	},
    	fichePrec: function () {
    		var nb = Portefeuille.nb_fiche_tab[Portefeuille.tab_open];
    		var num = Portefeuille.fiche_tab_open[Portefeuille.tab_open];
    		var fe = document.getElementById('fiche_entreprise_' + Portefeuille.tab_open + '_' + num + '');
    		fe.style.display = 'none';
    		var next = num - 1;
    		if (next == -1) {
    			next = nb;
    		}
    		var fe = document.getElementById('fiche_entreprise_' + Portefeuille.tab_open + '_' + next + '');
    		fe.style.display = 'block';
    		Portefeuille.fiche_tab_open[Portefeuille.tab_open] = next;
    		document.getElementById('loader').style.display = 'none';
    	},
    	ficheSuiv: function () {
    		var nb = Portefeuille.nb_fiche_tab[Portefeuille.tab_open];
    		var num = Portefeuille.first_fiche[Portefeuille.tab_open];
    		var fe = document.getElementById('fiche_entreprise_' + Portefeuille.tab_open + '_' + num + '');
    		fe.style.display = 'none';
    		var next = num + 1;
    		if (next > nb) {
    			next = 0;
    		}
    		var fe = document.getElementById('fiche_entreprise_' + Portefeuille.tab_open + '_' + next + '');
    		fe.style.display = 'block';
    		Portefeuille.fiche_tab_open[Portefeuille.tab_open] = next;
    		document.getElementById('loader').style.display = 'none';
    	},
    	alpha: function () {
    		Portefeuille.populate('alpha=oui&');
    	},
    	fichePrint: function (fiche_div) {
        	var Headers = '<!DOCTYPE HTML PUBLIC >' +
        					'<HTML>' +
        						'<HEAD>' +
        							'<title></title>' +
        						'</HEAD>' +
        						'<BODY style="color:black; background-color:white; padding:5px;" onload="window.print();window.close()">';
        	var Footers = '</body></html>';
        	var zi = document.getElementById(fiche_div).innerHTML;
        	var f = window.open("", "ZoneImpr", "height=700, width=600,toolbar=1, menubar=1, scrollbars=1, resizable=1, status=0, location=0, left=10, top=10");
        	f.document.write ("" + Headers + zi +Footers);
        	f.document.close();
        	return;
    	},
    	listePrint: function () {
    		var Headers = '<!DOCTYPE HTML PUBLIC >' +
        					'<HTML>' +
        						'<HEAD>' +
        							'<title></title>' +
        						'</HEAD>' +
        						'<BODY style="color:black; background-color:white; padding:5px;" onload="window.print();window.close()">';
        	var Footers = '</body></html>';
        	var zi = document.getElementById('portefeuille_liste_table').innerHTML;
        	var f = window.open("", "ZoneImpr", "height=700, width=600,toolbar=1, menubar=1, scrollbars=1, resizable=1, status=0, location=0, left=10, top=10");
        	f.document.write ("" + Headers + zi +Footers);
        	f.document.close();
        	return;
    	},
    	displayNews: function (id_news) {
    		var d = document.getElementById(id_news);
    		d.style.display = 'block';
    		document.getElementById('loader').style.display = 'none';
    	},
    	closeNews: function (id_news) {
    		var d = document.getElementById(id_news);
    		d.style.display = 'none';
    	},
    	switchMode: function (mode) {
    		if (mode != "complexe") {
    			var dpc = document.getElementById('portefeuille_complexe');
    			dpc.style.display = "none";
    			var dpl = document.getElementById('portefeuille_liste');
    			dpl.style.display = "block";
    			document.getElementById('loader').style.display = 'none';
    		}
    		else {
    			var dpc = document.getElementById('portefeuille_complexe');
    			dpc.style.display = "block";
    			var dpl = document.getElementById('portefeuille_liste');
    			dpl.style.display = "none";		
    			document.getElementById('loader').style.display = 'none';
    		}
    	},
    	dispFiche : function (id_bdd) {
    			var id = id_bdd.substr(0, id_bdd.indexOf('_'));
    			var tab = id_bdd.substr(id_bdd.indexOf('_') + 1);
    			tab = parseInt(tab) - 1 ;
    			var mon_div = document.getElementById(Portefeuille.first_fiche[tab] + "_" + tab);
    			mon_div.style.display = 'none';
    			Portefeuille.open(tab);
    			mon_div = document.getElementById(id + "_" + tab);
    			mon_div.style.display = 'block';
    			document.getElementById('loader').style.display = 'none';
    	}
    };
     
    function xhr_go(c){
    	if(!c.data.replace(/\s/g,''))
    		c.parentNode.removeChild(c);
    }
     
    function xhr_clean(d){
    	var bal=d.getElementsByTagName('*');
     
    	for(i=0;i<bal.length;i++){
    		a=bal[i].previousSibling;
    		if(a && a.nodeType==3)
    			xhr_go(a);
    		b=bal[i].nextSibling;
    		if(b && b.nodeType==3)
    			xhr_go(b);
    	}
    	return d;
    }

  2. #2
    Expert éminent sénior

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    13 474
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Secteur : Finance

    Informations forums :
    Inscription : Janvier 2007
    Messages : 13 474
    Points : 36 571
    Points
    36 571
    Par défaut
    Bonjour,
    tu utilises Ajax pour modifier ta page.
    L'intérêt d'Ajax (et pour toi, son inconvénient) et de modifier le contenu de la page sans changer de page.
    Les boutons "Suivant" et "Précédent" ne permettent que d'aller à la page suivante ou précédente, mais pas d'annuler les modifications faite dans une même page.
    Hélas, le CTRL+Z ne fonctionne pas

    Une chose que tu peux tenter :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    self.location.reload();
    pour retrouver ta page comme elle était au chargement initial.

    EDIT : et il ne s'agit pas du tout d'un bug

    A+

  3. #3
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    2
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2008
    Messages : 2
    Points : 1
    Points
    1
    Par défaut Erreur de mots
    Merci de ta réponse,

    En fait il s'agit des boutons de l'application et non de ceux du navigateur dont je parlais.

    Lorsque l'on clique sur affaire suivante ou affaire précédente, rien ne se passe.

    Avez vous un solution ?

    Merci

  4. #4
    Expert confirmé
    Avatar de RomainVALERI
    Homme Profil pro
    POOête
    Inscrit en
    Avril 2008
    Messages
    2 652
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Meurthe et Moselle (Lorraine)

    Informations professionnelles :
    Activité : POOête

    Informations forums :
    Inscription : Avril 2008
    Messages : 2 652
    Points : 4 164
    Points
    4 164
    Par défaut
    En suivant le lien que tu donnes (sur FF3), j'obtiens bien la page de ton site, mais après un très très long temps de chargement il n'arrive toujours pas à afficher "l'intérieur" de la page, qui contient les fameux boutons incriminés...

    Quoi qu'il en soit : as-tu essayé de débugger avec un outil adapté ? (genre firebug, FF Web developper, ou ne serait-ce qu'un inspecteur DOM)

Discussions similaires

  1. Deploiement d'une page Web avec AJAX
    Par DeveloppeurWeb dans le forum ASP.NET Ajax
    Réponses: 0
    Dernier message: 06/05/2010, 12h21
  2. [AJAX] ajax page loader avec changement url
    Par rfily dans le forum AJAX
    Réponses: 1
    Dernier message: 21/10/2009, 16h43
  3. Page dynamique avec Ajax et Struts 2
    Par mrjeronimo dans le forum Struts 2
    Réponses: 4
    Dernier message: 05/08/2008, 09h35
  4. [AJAX] Réafficher d'une page php avec ajax
    Par red_nour dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 20/06/2007, 08h21
  5. Erreur lors de l'appel d'une page executée avec AJAX
    Par jt-tronix dans le forum Langage
    Réponses: 3
    Dernier message: 08/11/2006, 17h56

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