Bonjour ,

J'essaye d'appeler deux scripts dans une même page , mais au chargement

de ma page j'arrive à faire marcher qu'un seul des scripts , j'ai utilisé la

fonction addloadevent pour charger les deux mais ca ne marche pas trop.

Peut-être que j'utilise mal la fonction aussi .

Voici mon code

Toute aide ou conseil est bienvenue

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
 
</style>
	<script type="text/javascript">
 
 
   var dhtmlgoodies_menuObj;   
   var currentZIndex = 1000; 
   var liIndex = 0; 
   var visibleMenus = new Array(); 
   var activeMenuItem = false; 
   var timeBeforeAutoHide = 1200; // Microseconds from mouse leaves menu to auto hide. 
   var dhtmlgoodies_menu_arrow = 'http://www.dhtmlgoodies.com/scripts/dhtmlgoodies-menu2/images/arrow.gif'; 
 
   var MSIE = navigator.userAgent.indexOf('MSIE')>=0?true:false; 
   var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox')>=0?true:false; 
   var navigatorVersion = navigator.appVersion.replace(/.*?MSIE ([0-9]\.[0-9]).*/g,'$1')/1; 
   var menuBlockArray = new Array(); 
   var menuParentOffsetLeft = false;    
 
 
    // {{{ getStyle() 
   /** 
   * Return specific style attribute for an element 
   * 
   * @param Object el = Reference to HTML element 
   * @param String property = Css property 
   * @private 
   */        
   function getStyle(el,property) 
   {        
 
      if (document.defaultView && document.defaultView.getComputedStyle) { 
 
         var retVal = null;              
         var comp = document.defaultView.getComputedStyle(el, ''); 
         if (comp){ 
            retVal = comp[property]; 
 
            if(!retVal){ 
               var comp = document.defaultView.getComputedStyle(el, null); 
               retVal = comp.getPropertyCSSValue(property); 
            }          
         }    
 
         if(retVal==null)retVal=''; 
 
         return el.style[property] || retVal; 
      } 
      if (document.documentElement.currentStyle && MSIE){    
         var value = el.currentStyle ? el.currentStyle[property] : null; 
         return ( el.style[property] || value ); 
 
      } 
      return el.style[property];              
   } 
 
   function getTopPos(inputObj) 
   { 
   	var origInputObj = inputObj;
 
     var returnValue = inputObj.offsetTop; 
     if(inputObj.tagName=='LI' && inputObj.parentNode.className=='menuBlock1'){    
        var aTag = inputObj.getElementsByTagName('A')[0]; 
        if(aTag)returnValue += aTag.parentNode.offsetHeight; 
     } 
     var topOfMenuReached = false; 
     while((inputObj = inputObj.offsetParent) != null){ 
        if(inputObj.parentNode.id=='dhtmlgoodies_menu')topOfMenuReached=true; 
        if(topOfMenuReached && !inputObj.className.match(/menuBlock/gi) || (!MSIE && origInputObj.parentNode.className=='menuBlock1')){ 
           var style = getStyle(inputObj,'position'); 
           if(style=='absolute' || style=='relative'){                
              return returnValue;            
           } 
        } 
 
        returnValue += inputObj.offsetTop;          
     } 
 
     return returnValue; 
   } 
 
   function getLeftPos(inputObj) 
   { 
     var returnValue = inputObj.offsetLeft; 
 
     var topOfMenuReached = false; 
     while((inputObj = inputObj.offsetParent) != null){ 
       if(inputObj.parentNode.id=='dhtmlgoodies_menu')topOfMenuReached=true; 
        if(topOfMenuReached && !inputObj.className.match(/menuBlock/gi)){ 
           var style = getStyle(inputObj,'position'); 
           if(style=='absolute' || style=='relative')return returnValue; 
        } 
 
        returnValue += inputObj.offsetLeft; 
     } 
     return returnValue; 
   } 
 
 
 
   function showHideSub() 
   { 
 
      var attr = this.parentNode.getAttribute('currentDepth'); 
      if(navigator.userAgent.indexOf('Opera')>=0){ 
         attr = this.parentNode.currentDepth; 
      } 
 
      this.className = 'currentDepth' + attr + 'over'; 
 
      if(activeMenuItem && activeMenuItem!=this){ 
         activeMenuItem.className=activeMenuItem.className.replace(/over/,''); 
      } 
      activeMenuItem = this; 
 
      var numericIdThis = this.id.replace(/[^0-9]/g,''); 
      var exceptionArray = new Array(); 
      // Showing sub item of this LI 
      var sub = document.getElementById('subOf' + numericIdThis); 
      if(sub){ 
         visibleMenus.push(sub); 
         sub.style.display=''; 
         sub.parentNode.className = sub.parentNode.className + 'over'; 
         exceptionArray[sub.id] = true; 
      }    
 
      // Showing parent items of this one 
 
      var parent = this.parentNode; 
      while(parent && parent.id && parent.tagName=='UL'){ 
         visibleMenus.push(parent); 
         exceptionArray[parent.id] = true; 
         parent.style.display=''; 
 
         var li = document.getElementById('dhtmlgoodies_listItem' + parent.id.replace(/[^0-9]/g,'')); 
         if(li.className.indexOf('over')<0)li.className = li.className + 'over'; 
         parent = li.parentNode; 
 
      } 
 
 
      hideMenuItems(exceptionArray); 
 
 
 
   } 
 
   function hideMenuItems(exceptionArray) 
   { 
      /* 
      Hiding visible menu items 
      */ 
      var newVisibleMenuArray = new Array(); 
      for(var no=0;no<visibleMenus.length;no++){ 
         if(visibleMenus[no].className!='menuBlock1' && visibleMenus[no].id){ 
            if(!exceptionArray[visibleMenus[no].id]){ 
               var el = visibleMenus[no].getElementsByTagName('A')[0]; 
               visibleMenus[no].style.display = 'none'; 
               var li = document.getElementById('dhtmlgoodies_listItem' + visibleMenus[no].id.replace(/[^0-9]/g,'')); 
               if(li.className.indexOf('over')>0)li.className = li.className.replace(/over/,''); 
            }else{              
               newVisibleMenuArray.push(visibleMenus[no]); 
            } 
         } 
      }        
      visibleMenus = newVisibleMenuArray;        
   } 
 
 
 
   var menuActive = true; 
   var hideTimer = 0; 
   function mouseOverMenu() 
   { 
      menuActive = true;        
   } 
 
   function mouseOutMenu() 
   { 
      menuActive = false; 
      timerAutoHide();    
   } 
 
   function timerAutoHide() 
   { 
      if(menuActive){ 
         hideTimer = 0; 
         return; 
      } 
 
      if(hideTimer<timeBeforeAutoHide){ 
         hideTimer+=100; 
         setTimeout('timerAutoHide()',99); 
      }else{ 
         hideTimer = 0; 
         autohideMenuItems();    
      } 
   } 
 
   function autohideMenuItems() 
   { 
      if(!menuActive){ 
         hideMenuItems(new Array());    
         if(activeMenuItem)activeMenuItem.className=activeMenuItem.className.replace(/over/,'');        
      } 
   } 
 
 
   function initSubMenus(inputObj,initOffsetLeft,currentDepth) 
   {    
      var subUl = inputObj.getElementsByTagName('UL'); 
      if(subUl.length>0){ 
         var ul = subUl[0]; 
 
         ul.id = 'subOf' + inputObj.id.replace(/[^0-9]/g,''); 
         ul.setAttribute('currentDepth' ,currentDepth); 
         ul.currentDepth = currentDepth; 
         ul.className='menuBlock' + currentDepth; 
         ul.onmouseover = mouseOverMenu; 
         ul.onmouseout = mouseOutMenu; 
         currentZIndex+=1; 
         ul.style.zIndex = currentZIndex; 
         menuBlockArray.push(ul); 
         ul = dhtmlgoodies_menuObj.appendChild(ul); 
         var topPos = getTopPos(inputObj); 
         var leftPos = getLeftPos(inputObj)/1 + initOffsetLeft/1;          
 
         ul.style.position = 'absolute'; 
         ul.style.left = leftPos + 'px'; 
         ul.style.top = topPos + 'px'; 
         var li = ul.getElementsByTagName('LI')[0]; 
         while(li){ 
            if(li.tagName=='LI'){    
               li.className='currentDepth' + currentDepth;                
               li.id = 'dhtmlgoodies_listItem' + liIndex; 
               liIndex++;              
               var uls = li.getElementsByTagName('UL'); 
               li.onmouseover = showHideSub; 
 
               if(uls.length>0){ 
                  var offsetToFunction = li.getElementsByTagName('A')[0].offsetWidth+2; 
                  if(navigatorVersion<6 && MSIE)offsetToFunction+=15;   // MSIE 5.x fix 
                  initSubMenus(li,offsetToFunction,(currentDepth+1)); 
               }    
               if(MSIE){ 
                  var a = li.getElementsByTagName('A')[0]; 
                  a.style.width=li.offsetWidth+'px'; 
                  a.style.display='block'; 
               }                
            } 
            li = li.nextSibling; 
         } 
         ul.style.display = 'none';    
         if(!document.all){ 
            //dhtmlgoodies_menuObj.appendChild(ul); 
         } 
      }    
   } 
 
 
   function resizeMenu() 
   { 
      var offsetParent = getLeftPos(dhtmlgoodies_menuObj); 
 
      for(var no=0;no<menuBlockArray.length;no++){ 
         var leftPos = menuBlockArray[no].style.left.replace('px','')/1; 
         menuBlockArray[no].style.left = leftPos + offsetParent - menuParentOffsetLeft + 'px'; 
      } 
      menuParentOffsetLeft = offsetParent; 
   } 
 
   /* 
   Initializing menu 
   */ 
   function initDhtmlGoodiesMenu() 
   { 
      dhtmlgoodies_menuObj = document.getElementById('dhtmlgoodies_menu'); 
 
 
      var aTags = dhtmlgoodies_menuObj.getElementsByTagName('A'); 
      for(var no=0;no<aTags.length;no++){          
 
         var subUl = aTags[no].parentNode.getElementsByTagName('UL'); 
         if(subUl.length>0 && aTags[no].parentNode.parentNode.parentNode.id != 'dhtmlgoodies_menu'){ 
            var img = document.createElement('IMG'); 
            img.src = dhtmlgoodies_menu_arrow; 
            aTags[no].appendChild(img);              
 
         } 
 
      } 
 
      var mainMenu = dhtmlgoodies_menuObj.getElementsByTagName('UL')[0]; 
      mainMenu.className='menuBlock1'; 
      mainMenu.style.zIndex = currentZIndex; 
      mainMenu.setAttribute('currentDepth' ,1); 
      mainMenu.currentDepth = '1'; 
      mainMenu.onmouseover = mouseOverMenu; 
      mainMenu.onmouseout = mouseOutMenu;        
 
      var mainMenuItemsArray = new Array(); 
      var mainMenuItem = mainMenu.getElementsByTagName('LI')[0]; 
      mainMenu.style.height = mainMenuItem.offsetHeight + 2 + 'px'; 
      while(mainMenuItem){ 
 
         mainMenuItem.className='currentDepth1'; 
         mainMenuItem.id = 'dhtmlgoodies_listItem' + liIndex; 
         mainMenuItem.onmouseover = showHideSub; 
         liIndex++;              
         if(mainMenuItem.tagName=='LI'){ 
            mainMenuItem.style.cssText = 'float:left;';    
            mainMenuItem.style.styleFloat = 'left'; 
            mainMenuItemsArray[mainMenuItemsArray.length] = mainMenuItem; 
            initSubMenus(mainMenuItem,0,2); 
         }          
 
         mainMenuItem = mainMenuItem.nextSibling; 
 
      } 
 
      for(var no=0;no<mainMenuItemsArray.length;no++){ 
         initSubMenus(mainMenuItemsArray[no],0,2);          
      } 
 
      menuParentOffsetLeft = getLeftPos(dhtmlgoodies_menuObj);    
      window.onresize = resizeMenu;    
      dhtmlgoodies_menuObj.style.visibility = 'visible';    
   } 
	function UnScriptDePlus(func)
 
{
 
   var oldonload = window.onload;
 
   if(typeof window.onload != 'function')
 
   {
 
      window.onload = func;
 
   }
 
   else
 
   {
 
      window.onload = function()
 
      {
 
         oldonload();
 
         func();
 
      }
 
   }
 
}
 
UnScriptDePlus(InitDhtmlGoodiesMenu);
UnScriptDePlus(initdragableElements);
	</script>
deuxieme script
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
 
if(!window.rememberPositionedInCookie)var rememberPositionedInCookie = false;
	if(!window.rememberPosition_cookieName)var rememberPosition_cookieName = 'demo';
 
 
	var dragObjArray = new Array();
	var dragObjCloneArray = new Array();
	var numericIdToBeDragged = false;
	var dragDropTimer = -1;
 
	var mouse_x;
	var mouse_y;
 
	var el_x;
	var el_y;
 
	var currentZIndex = 10000;
	var dragableElementMoved = new Array();
 
	var dragableContent_cookieString;
	var dragableContent_cookieItems = new Array();
 
 
	/*
	These cookie functions are downloaded from 
	http://www.mach5.com/support/analyzer/manual/html/General/CookiesJavaScript.htm
	*/	
	function Get_Cookie(name) { 
	   var start = document.cookie.indexOf(name+"="); 
	   var len = start+name.length+1; 
	   if ((!start) && (name != document.cookie.substring(0,name.length))) return null; 
	   if (start == -1) return null; 
	   var end = document.cookie.indexOf(";",len); 
	   if (end == -1) end = document.cookie.length; 
	   return unescape(document.cookie.substring(len,end)); 
	} 
	// This function has been slightly modified
	function Set_Cookie(name,value,expires,path,domain,secure) { 
		expires = expires * 60*60*24*1000;
		var today = new Date();
		var expires_date = new Date( today.getTime() + (expires) );
	    var cookieString = name + "=" +escape(value) + 
	       ( (expires) ? ";expires=" + expires_date.toGMTString() : "") + 
	       ( (path) ? ";path=" + path : "") + 
	       ( (domain) ? ";domain=" + domain : "") + 
	       ( (secure) ? ";secure" : ""); 
	    document.cookie = cookieString; 
	} 
 
 
	function getTopPos(inputObj)
	{		
	  var returnValue = inputObj.offsetTop;
	  while((inputObj = inputObj.offsetParent) != null){
	  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;
	  }
	  return returnValue;
	}
 
	function getLeftPos(inputObj)
	{
	  var returnValue = inputObj.offsetLeft;
	  while((inputObj = inputObj.offsetParent) != null){
	  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetLeft;
	  }
	  return returnValue;
	}
 
	function initDragDropElement(e)
	{
		if(document.all)e = event;
 
		if(document.all)e = event;
		if (e.target) source = e.target;
			else if (e.srcElement) source = e.srcElement;
			if (source.nodeType == 3) // defeat Safari bug
				source = source.parentNode;	
		if(source.tagName.toLowerCase()=='input' || source.tagName.toLowerCase()=='textarea')return false;	
 
 
		numericIdToBeDragged = this.className.replace(/[^0-9]/g,'');
		dragDropTimer=0;
		mouse_x = e.clientX;
		mouse_y = e.clientY;
 
		currentZIndex = currentZIndex + 1;
 
		dragObjCloneArray[numericIdToBeDragged].style.zIndex = currentZIndex;
 
		if(!dragableElementMoved[numericIdToBeDragged]){
			dragObjCloneArray[numericIdToBeDragged].style.top = getTopPos(dragObjArray[numericIdToBeDragged]) + 'px';
			dragObjCloneArray[numericIdToBeDragged].style.left = getLeftPos(dragObjArray[numericIdToBeDragged]) + 'px';
		}				
		el_x = dragObjCloneArray[numericIdToBeDragged].style.left.replace('px','')/1;
		el_y = dragObjCloneArray[numericIdToBeDragged].style.top.replace('px','')/1;
 
 
		timerDragDropElement();
		return false;
	}
 
	function timerDragDropElement()
	{
		if(dragDropTimer>=0 && dragDropTimer<10){
			dragDropTimer = dragDropTimer + 1;
			setTimeout('timerDragDropElement()',5);
			return;			
		}
		if(dragDropTimer>=10){
			if(dragObjCloneArray[numericIdToBeDragged].style.display=='none'){
				dragObjArray[numericIdToBeDragged].style.visibility = 'hidden';
				dragObjCloneArray[numericIdToBeDragged].style.display = 'block';
				dragObjCloneArray[numericIdToBeDragged].style.visibility = 'visible';
				dragObjCloneArray[numericIdToBeDragged].style.top = getTopPos(dragObjArray[numericIdToBeDragged]) + 'px';
				dragObjCloneArray[numericIdToBeDragged].style.left = getLeftPos(dragObjArray[numericIdToBeDragged]) + 'px';
				dragableElementMoved[numericIdToBeDragged] = true;	
			}
		}		
	}
 
	function cancelEvent()
	{
		return false;
	}
 
	function cancelSelectionEvent()
	{
		if(dragDropTimer>=0)return false;
		return true;
	}
 
	function moveDragableElement(e)
	{
		if(document.all)e = event;		
		if(dragDropTimer<10)return;	
		dragObjCloneArray[numericIdToBeDragged].style.left = (e.clientX - mouse_x + el_x) + 'px'; 
		dragObjCloneArray[numericIdToBeDragged].style.top = (e.clientY - mouse_y + el_y) + 'px'; 
	}
 
	function stop_dragDropElement()
	{
		dragDropTimer = -1;
 
		if(rememberPositionedInCookie && dragObjCloneArray[numericIdToBeDragged]){		
			dragableContent_cookieItems['dragableElementClone' + numericIdToBeDragged] = [dragObjCloneArray[numericIdToBeDragged].style.left,dragObjCloneArray[numericIdToBeDragged].style.top,dragObjCloneArray[numericIdToBeDragged].style.zIndex]; 
		}
		if(rememberPositionedInCookie)createCookieString();
		numericIdToBeDragged = false;
	}
 
	function createCookieString()
	{
		var stringToSave = '';
		for(var prop in dragableContent_cookieItems){
			if(stringToSave)stringToSave = stringToSave + '###';
			stringToSave = stringToSave + prop + ',' + dragableContent_cookieItems[prop][0] + ',' +  dragableContent_cookieItems[prop][1] + ',' +  dragableContent_cookieItems[prop][2];
		}	
		Set_Cookie(rememberPosition_cookieName,stringToSave,60000000);
	}
 
 
	function initdragableElements()
	{
		var dragableContent_cookieString = false;
		if(rememberPositionedInCookie){
			dragableContent_cookieString = Get_Cookie(rememberPosition_cookieName);
		}
		var tmpElements = new Array();
		var allObjects = document.getElementsByTagName('*');
		for(var no=0;no<allObjects.length;no++){
			if(allObjects[no].className=='dragableElement'){
				allObjects[no].style.cursor = 'move';
				tmpElements[tmpElements.length] = allObjects[no];
			}
		}
 
		for(var no=0;no<tmpElements.length;no++){
			var el = tmpElements[no].cloneNode(true);
			tmpElements[no].className='dragableElement' + no;
			el.onmousedown = initDragDropElement;
			el.className='dragableElementClone' + no;			
 
			el.style.position='absolute';
			el.style.display='none';
			el.style.visibility='hidden';
 
			el.style.top = getTopPos(tmpElements[no]) + 'px';
			el.style.left = getLeftPos(tmpElements[no]) + 'px';
			tmpElements[no].parentNode.insertBefore(el,tmpElements[no]);
			tmpElements[no].onmousedown = initDragDropElement;
 
			dragObjArray[no] = tmpElements[no]; 
			dragObjCloneArray[no] = el; 
		}
 
		document.body.onmousemove = moveDragableElement;
		document.body.onmouseup = stop_dragDropElement;
		document.body.onselectstart = cancelSelectionEvent;
		document.body.ondragstart = cancelEvent;
 
		// Position cookie elements
		if(dragableContent_cookieString){
 
			var items = dragableContent_cookieString.split('###');
			for(var no=0;no<items.length;no++){
				var tokens = items[no].split(',');
				dragableContent_cookieItems[tokens[0]] = [tokens[1] ,tokens[2],tokens[3]];				
			}	
			positionItemsFromCookie();	
		}
	}
 
	function positionItemsFromCookie()
	{
		for(var prop in dragableContent_cookieItems){
			for(var no=0;no<dragObjCloneArray.length;no++){
				if(dragObjCloneArray[no].className==prop){
					dragableElementMoved[no] = true;
					dragObjCloneArray[no].style.display='block';
					dragObjArray[no].style.visibility = 'hidden';
					dragObjCloneArray[no].style.visibility = 'visible';
					dragObjCloneArray[no].style.left = dragableContent_cookieItems[prop][0];
					dragObjCloneArray[no].style.top = dragableContent_cookieItems[prop][1];
					dragObjCloneArray[no].style.zIndex = dragableContent_cookieItems[prop][2];
					currentZIndex = Math.max(currentZIndex,dragableContent_cookieItems[prop][2]/1 + 1);
 
				}
			}
		}
	}