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] sondage marche pas sous firefox (lotus notes)


Sujet :

JavaScript

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Novembre 2007
    Messages
    88
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2007
    Messages : 88
    Points : 44
    Points
    44
    Par défaut [AJAX] sondage marche pas sous firefox (lotus notes)
    Bonjour,

    Mon sondage marche très bien sur IE, en revanche la requete ne se fait pas sous firefox. Si quelqu'un voit pourquoi : ?

    fichier html :
    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
     
    <html>
    <head>
    <style type="text/css">
      @import url(sondage_ajax.css);
    </style>
     
    <script type="text/javascript" src="prototype.js"></script>
    <script type="text/javascript" src="ajaxwebpoll.js"></script>
     
    </head>
    <body>
    <div id="MNEI-7BAJAQ" class="BlogPollContents">
    <form name="MNEI-7BAJAQ" method="post" action="javascript:vote('MNEI-7BAJAQ')">
    	<div class="PollTitle">
    		beau
    	</div>
    	<div class="PollChoice">
    		<input name="PollOption" value="ben" type="radio"> ben<br>
    		<input name="PollOption" value="max" type="radio"> max<br>
    		<input name="PollOption" value="bush" type="radio"> bush<br>
    	 </div><br>
    		<input name="Pollid" value="MNEI-7BAJAQ" type="hidden">
    		<input name="PollTitle" value="beau" type="hidden">
    		<input value="Vote" onClick="vote('MNEI-7BAJAQ')" style="background: transparent" type="button">  
    		<input value="Results" onClick="view('MNEI-7BAJAQ')" style="background: transparent" type="button">
     </form>
     </div>
     </body>
     </html>
    mon fichier .js
    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
     
    var ck = document.cookie;
    var dbWebPollPath = 'http://com-unity.staging.echonet/applis/wGroup/Dev/wGroup.nsf/';
    var pollid ='';
     
    function getWidgets()
    {
    getWebPolls();
    getWebStars();
    }
     
     
    function getWebPolls()
    {
     
    	var pollList = document.getElementsByClassName("BlogPollContents");
     
    	for (var i = 0; i < pollList.length; i++) {
    		var divWebPoll = $(pollList[i].id);
    		divWebPoll.innerHTML='<center><img src="indicator.gif"></center>'
    		if(ck.indexOf(pollList[i].id) != -1){
    			view(pollList[i].id);
    		}else{
    			var url = dbWebPollPath+'webpoll?OpenPage&rdm='+Math.random();
    			var params = 'survey=' + pollList[i].id;
    			var myAjax = new Ajax.Request( url, { method: 'get', parameters: params,onComplete: showWebPoll });
    		}
    	}
    }
     
    function showWebPoll(originalRequest)
    {
    		var xmldoc = originalRequest.responseXML;
    		var root = xmldoc.documentElement;
    		var pollid = getInnerText (root.getElementsByTagName("Pollid")[0]);
    		var divWebPoll = $(pollid);
    		divWebPoll.innerHTML=getInnerText (root.getElementsByTagName("PollContents")[0]);
    }
     
    function SetCookie(cookieName,cookieValue,nDays)
    { 
    	var today = new Date();
    	var expire = new Date();
    	if (nDays==null || nDays==0) nDays=100;
    	expire.setTime(today.getTime() + 3600000*24*nDays);
    	document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString();
    }
     
    function vote(currPoll)
    {
    	if (getRB(document.forms[currPoll],'PollOption').value) {}else{
    		alert('Veuillez S\u00E9lectionnez une r\u00E9ponse');
    		return;
    	}
    	//SetCookie(currPoll, document.forms[currPoll].PollOption.value, 180);
    	form= document.forms[currPoll];	
    	var params = Form.serialize(form);
    	var url = dbWebPollPath+'PollEntry?createdocument';
    	pollid=currPoll;
    	var divWebPoll = $(currPoll);
    	divWebPoll.innerHTML='<center><img src="indicator.gif"></center>'
     
    	  var myAjax = false;
     
            if (window.XMLHttpRequest) { // Mozilla, Safari,...
                myAjax = new XMLHttpRequest();
                if (myAjax.overrideMimeType) {
                    myAjax.overrideMimeType('text/xml');
                    // Voir la note ci-dessous à propos de cette ligne
                }
            }
            else if (window.ActiveXObject) { // IE
                try {
                    myAjax = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch (e) {
                    try {
                        myAjax = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    catch (e) {}
                }
            }
     
            if (!myAjax) {
                alert('Abandon :( Impossible de créer une instance XMLHTTP');
                return false;
            }
     
    	myAjax = new Ajax.Request( url, { method: 'post',parameters: params,requestHeaders: ['Accept-Charset','utf-8','Content-Type','text/html'],onComplete: viewResult });
    	alert(myAjax);
    	alert(url);
    	alert(params);
    } 
     
    function viewResult(originalRequest)
    {
    	view(pollid);
    }
     
    function view(p_pollid)
    {
    	var divWebPoll = $(p_pollid);
    	divWebPoll.innerHTML='<center><img src="indicator.gif"></center>'
    	if (p_pollid=='undefined') p_pollid=pollid
    	var url = dbWebPollPath+'webpollresult?OpenPage&rdm='+Math.random();
    	var params = 'survey=' + p_pollid;
     
    	var myAjax = new Ajax.Request( url, { method: 'get', parameters: params,onComplete: showWebPoll });
    }
     
    function getRB(form,rbName) {
    	rbFld=eval('form.'+rbName);
    	for (var i = 0; i < rbFld.length; i++) {
    		if (rbFld[i].checked == true) {
    			return rbFld[i];
    		}
    	}
    	return rbFld
    }
     
     
    function getInnerText (node) {
    	if (typeof node.textContent != 'undefined') {
    		return node.textContent;
    	} else if (typeof node.innerText != 'undefined') {
    		return node.innerText;
    	} else if (typeof node.text != 'undefined') {
    		return node.text;
    	} else {
    		switch (node.nodeType) {
    			case 3:
    			case 4:
    				return node.nodeValue;
    				break;
    			case 1:
    			case 11:
    				var innerText = '';
    				for (var i = 0; i < node.childNodes.length; i++) {
    					innerText += getInnerText(node.childNodes[i]);
    				}
    				return innerText;
    				break;
    			default:
    				return '';
    		}
    	}
    }
     
    //********************************************** Function for stars vote*************************************************
     
    function getWebStars()
    {
     
    	var starsList = document.getElementsByClassName("BlogStarsContents");
     
    	for (var i = 0; i < starsList.length; i++) {
    		var divWebStars = $(starsList[i].id);
    		//divWebStars.innerHTML='<center><img src="indicator.gif"></center>'
    		if(ck.indexOf(starsList[i].id) != -1){
    			view(starsList[i].id);
    		}else{
    			var url = dbWebPollPath+'webstars?OpenPage&rdm='+Math.random();
     
    			var params = 'starsid=' + starsList[i].id;
    			var myAjax = new Ajax.Request( url, { method: 'get', parameters: params,onComplete: showWebStars });
    		}
    	}
    }
     
    function showWebStars(originalRequest)
    {
    		var xmldoc = originalRequest.responseXML;
     
    		var root = xmldoc.documentElement;
    		var pollid = getInnerText (root.getElementsByTagName("Starsid")[0]);
    		var divWebPoll = $(pollid);
    		divWebPoll.innerHTML=getInnerText (root.getElementsByTagName("StarsContents")[0]);
    }
     
    function votio_vote(starsid,rate)
    {
     
    	SetCookie(starsid, document.forms[starsid].PollOption.value, 180);
    	form= document.forms[starsid];	
    	form.StarsValue.value=rate;
    	var params = Form.serialize(form);
     
    	var url = dbWebPollPath+'StarsEntry?createdocument';
    	var divWebPoll = $(starsid);
    	//divWebPoll.innerHTML='<center><img src="indicator.gif"></center>'
    	var myAjax = new Ajax.Request( url, { method: 'post',parameters: params,requestHeaders: ['Accept-Charset','utf-8','Content-Type','text/html'],onComplete: viewStarsResult });
     
    } 
     
    function viewStarsResult(originalRequest)
    {
    	if (p_pollid=='undefined') p_pollid=pollid
    	var url = dbWebPollPath+'webpollresult?OpenPage&rdm='+Math.random();
    	var params = 'survey=' + p_pollid;
    	var myAjax = new Ajax.Request( url, { method: 'get', parameters: params,onComplete: showWebStars });
    }
     
     
    var ratings = new Array;
     
    function votio_getHTTPObject() {
    	var xmlhttp; 
    	if (!xmlhttp && typeof XMLHttpRequest != "undefined") { 
    		try { 
    			xmlhttp = new XMLHttpRequest(); 
    		} catch (e) { 
    			xmlhttp = false; 
    		} 
    	} 
    	return xmlhttp; 
    } 
     
    function votio_handleHttpResponse()
    {
    	if(votio_http.readyState == 4)
    	{
    		var s = votio_http.responseText;
    		var res = s.split(",");
    		var id = res[0];
    		var index = res[1];
    		var message = res[2];
    		var textmsg = document.createTextNode(message);
    		var votediv = document.getElementById('votediv_' + id);
    		votediv.removeChild(votediv.firstChild);
    		votediv.appendChild(textmsg);
    		for(z=1;z<=5;z++)
    		{
    			i = document.getElementById("star_" + id + "_" + z);
    			if (z <= index)
    				usei = "star1.gif";
    			else
    				usei = "star0.gif";
    			i.setAttribute("src", usei);
    			i.setAttribute("onmouseover", null);
    			i.setAttribute("onmouseout", null);
    		}
    	}
    }
     
     
     
    function votio_hover(id, index, rating)
    {
    	var i;
    	ratings[id] = rating;
    	for (z=1; z<=5; z++) {
    		i = document.getElementById(id + "_" + z);
    		if (z <= index) {
    			usei = "starvs.gif";
    		} else {
    			usei = "starv.gif";
    		}
    		i.setAttribute("src", usei);
    	}
    }
    function votio_unhover(id, index)
    {
    	var i;
     
    	for (z=1; z<=5; z++) {
    		i = document.getElementById(id + "_" + z);
    		im = (ratings[id] >= z) ? "star1.gif" : "star0.gif";
    		usei = im;
    		i.setAttribute("src", usei);
    	}
    }
     
    //************************max
     
    function bonobjet() {
     
            var myAjax = false;
     
            if (window.XMLHttpRequest) { // Mozilla, Safari,...
                myAjax = new XMLHttpRequest();
                if (myAjax.overrideMimeType) {
                    myAjax.overrideMimeType('text/xml');
                    // Voir la note ci-dessous à propos de cette ligne
                }
            }
            else if (window.ActiveXObject) { // IE
                try {
                    myAjax = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch (e) {
                    try {
                        myAjax = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    catch (e) {}
                }
            }
     
            if (!myAjax) {
                alert('Abandon :( Impossible de créer une instance XMLHTTP');
                return false;
            }
               }

  2. #2
    Membre du Club
    Profil pro
    Inscrit en
    Novembre 2007
    Messages
    88
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2007
    Messages : 88
    Points : 44
    Points
    44
    Par défaut
    j'ai un peu avancé, ça vient pas de notes mais du traitement en js:

    Quand je tape dans la barre d'url :
    http://com-unity.staging.echonet/app...PollTitle=beau

    sur IE : ok incrementation de la réponse
    sur Firefox : ok incrementation de la réponse

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Novembre 2007
    Messages
    88
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2007
    Messages : 88
    Points : 44
    Points
    44
    Par défaut
    Besoin d'aide svp

Discussions similaires

  1. drag and drop march pas sous firefox+joomla!
    Par tecap dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 02/10/2007, 10h16
  2. fonction redimensionnement marche pas sous firefox
    Par calitom dans le forum Général JavaScript
    Réponses: 9
    Dernier message: 11/09/2007, 14h39
  3. le ValidationSummary ASP ne marche pas sous Firefox
    Par hokidoki dans le forum ASP.NET
    Réponses: 15
    Dernier message: 16/08/2007, 10h30
  4. [AJAX] Ajax ne marche pas sous IE pour MAC
    Par sami_c dans le forum Général JavaScript
    Réponses: 12
    Dernier message: 26/06/2007, 14h52
  5. Fonction qui ne marche pas sous FireFox
    Par Foudébois dans le forum Général JavaScript
    Réponses: 8
    Dernier message: 17/11/2006, 14h35

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