|
Dernière réponse | |
---|---|
Sujet : [JAVASCRIPT] onmouseover décrit dans la fonction ... | |
M@nu | bon ça va ça va !!!
C'est effectivement un script avec un truc qui suit la souris... et ça marche !! Bon, je connais presque rien en javascript... |
Aperçu |
---|
Vue Rapide de la discussion |
---|
M@nu | bon ça va ça va !!!
C'est effectivement un script avec un truc qui suit la souris... et ça marche !! Bon, je connais presque rien en javascript... |
k666 | c pas cool ton truc ça marche que sous IE, ça fout une crise cardiaque à 25% de la pla-NET |
MagicBuzz | il est marteau dans sa tête le monsieur...
tiens, je te montre une partie des scripts qu'il y a sur mo site perso (avec ça normalement tu fais une crise cardiaque...) :p if ((window.navigator.appName != "Microsoft Internet Explorer" ) || (window.navigator.appVersion.indexOf("5.5" ) == -1)) { var Test = false; document.location.href="index_ns.asp" } else { var Test = true; } strLOAD = "" window.top.test_1 = new Object(); window.top.test_1.flag = false; window.top.test_1.posX = 0; window.top.test_1.posY = 0; ss window.top.test2_1 = new Object(); window.top.test2_1.flag = false; window.top.test2_1.posX = 0; window.top.test2_1.posY = 0; window.top.load1 = false; window.top.test_2 = new Object(); window.top.test_2.flag = false; window.top.test_2.posX = 0; window.top.test_2.posY = 0; ss window.top.test2_2 = new Object(); window.top.test2_2.flag = false; window.top.test2_2.posX = 0; window.top.test2_2.posY = 0; window.top.load2 = false; window.top.test_3 = new Object(); window.top.test_3.flag = false; window.top.test_3.posX = 0; window.top.test_3.posY = 0; ss window.top.test2_3 = new Object(); window.top.test2_3.flag = false; window.top.test2_3.posX = 0; window.top.test2_3.posY = 0; window.top.load3 = false; window.top.test_4 = new Object(); window.top.test_4.flag = false; window.top.test_4.posX = 0; window.top.test_4.posY = 0; ss window.top.test2_4 = new Object(); window.top.test2_4.flag = false; window.top.test2_4.posX = 0; window.top.test2_4.posY = 0; window.top.load4 = false; window.top.test_5 = new Object(); window.top.test_5.flag = false; window.top.test_5.posX = 0; window.top.test_5.posY = 0; ss window.top.test2_5 = new Object(); window.top.test2_5.flag = false; window.top.test2_5.posX = 0; window.top.test2_5.posY = 0; window.top.load5 = false; window.top.test_6 = new Object(); window.top.test_6.flag = false; window.top.test_6.posX = 0; window.top.test_6.posY = 0; ss window.top.test2_6 = new Object(); window.top.test2_6.flag = false; window.top.test2_6.posX = 0; window.top.test2_6.posY = 0; window.top.load6 = false; window.top.test_7 = new Object(); window.top.test_7.flag = false; window.top.test_7.posX = 0; window.top.test_7.posY = 0; ss window.top.test2_7 = new Object(); window.top.test2_7.flag = false; window.top.test2_7.posX = 0; window.top.test2_7.posY = 0; window.top.load7 = false; window.top.test_8 = new Object(); window.top.test_8.flag = false; window.top.test_8.posX = 0; window.top.test_8.posY = 0; ss window.top.test2_8 = new Object(); window.top.test2_8.flag = false; window.top.test2_8.posX = 0; window.top.test2_8.posY = 0; window.top.load8 = false; window.top.test_9 = new Object(); window.top.test_9.flag = false; window.top.test_9.posX = 0; window.top.test_9.posY = 0; ss window.top.test2_9 = new Object(); window.top.test2_9.flag = false; window.top.test2_9.posX = 0; window.top.test2_9.posY = 0; window.top.load9 = false; window.top.test_10 = new Object(); window.top.test_10.flag = false; window.top.test_10.posX = 0; window.top.test_10.posY = 0; ss window.top.test2_10 = new Object(); window.top.test2_10.flag = false; window.top.test2_10.posX = 0; window.top.test2_10.posY = 0; window.top.load10 = false; function loadOK() { return (window.top.load1 && window.top.load2 && window.top.load3 && window.top.load4 && window.top.load5 && window.top.load6 && window.top.load7 && window.top.load8 && window.top.load9 && window.top.load10); } function doClick(win) { if (loadOK()) { ssif (win == 1) ss document.all.Win1.style.zIndex = 2; sselse ss document.all.Win1.style.zIndex = 1; ssif (win == 2) ss document.all.Win2.style.zIndex = 2; sselse ss document.all.Win2.style.zIndex = 1; ssif (win == 3) ss document.all.Win3.style.zIndex = 2; sselse ss document.all.Win3.style.zIndex = 1; ssif (win == 4) ss document.all.Win4.style.zIndex = 2; sselse ss document.all.Win4.style.zIndex = 1; ssif (win == 5) ss document.all.Win5.style.zIndex = 2; sselse ss document.all.Win5.style.zIndex = 1; ssif (win == 6) ss document.all.Win6.style.zIndex = 2; sselse ss document.all.Win6.style.zIndex = 1; ssif (win == 7) ss document.all.Win7.style.zIndex = 2; sselse ss document.all.Win7.style.zIndex = 1; ssif (win == 8) ss document.all.Win8.style.zIndex = 2; sselse ss document.all.Win8.style.zIndex = 1; ssif (win == 9) ss document.all.Win9.style.zIndex = 2; sselse ss document.all.Win9.style.zIndex = 1; ssif (win == 10) ss document.all.Win10.style.zIndex = 2; sselse ss document.all.Win10.style.zIndex = 1; } } function doMove(X, Y) { doWinMove(X, Y); doResize(X, Y); } function doWinMove(X, Y) { if (Test && loadOK()) { ssif (window.top.test_1.flag) ss{ ss document.all.Win1.style.left = X - window.top.test_1.posX; ss document.all.Win1.style.top = Y - window.top.test_1.posY; ss} ssif (window.top.test_2.flag) ss{ ss document.all.Win2.style.left = X - window.top.test_2.posX; ss document.all.Win2.style.top = Y - window.top.test_2.posY; ss} ssif (window.top.test_3.flag) ss{ ss document.all.Win3.style.left = X - window.top.test_3.posX; ss document.all.Win3.style.top = Y - window.top.test_3.posY; ss} ssif (window.top.test_4.flag) ss{ ss document.all.Win4.style.left = X - window.top.test_4.posX; ss document.all.Win4.style.top = Y - window.top.test_4.posY; ss} ssif (window.top.test_5.flag) ss{ ss document.all.Win5.style.left = X - window.top.test_5.posX; ss document.all.Win5.style.top = Y - window.top.test_5.posY; ss} ssif (window.top.test_6.flag) ss{ ss document.all.Win6.style.left = X - window.top.test_6.posX; ss document.all.Win6.style.top = Y - window.top.test_6.posY; ss} ssif (window.top.test_7.flag) ss{ ss document.all.Win7.style.left = X - window.top.test_7.posX; ss document.all.Win7.style.top = Y - window.top.test_7.posY; ss} ssif (window.top.test_8.flag) ss{ ss document.all.Win8.style.left = X - window.top.test_8.posX; ss document.all.Win8.style.top = Y - window.top.test_8.posY; ss} ssif (window.top.test_9.flag) ss{ ss document.all.Win9.style.left = X - window.top.test_9.posX; ss document.all.Win9.style.top = Y - window.top.test_9.posY; ss} ssif (window.top.test_10.flag) ss{ ss document.all.Win10.style.left = X - window.top.test_10.posX; ss document.all.Win10.style.top = Y - window.top.test_10.posY; ss} } } function doResize(X, Y) { if (Test && loadOK()) { ssif (window.top.test2_1.flag) ss{ ss document.all.ZONE1.width = X - parseInt(document.all.Win1.style.left) + 8; ss document.all.ZONE1.height = Y - parseInt(document.all.Win1.style.top) - 30; ss ControlNewSize(1); ss} ssif (window.top.test2_2.flag) ss{ ss document.all.ZONE2.width = X - parseInt(document.all.Win2.style.left) + 8; ss document.all.ZONE2.height = Y - parseInt(document.all.Win2.style.top) - 30; ss ControlNewSize(2); ss} ssif (window.top.test2_3.flag) ss{ ss document.all.ZONE3.width = X - parseInt(document.all.Win3.style.left) + 8; ss document.all.ZONE3.height = Y - parseInt(document.all.Win3.style.top) - 30; ss ControlNewSize(3); ss} ssif (window.top.test2_4.flag) ss{ ss document.all.ZONE4.width = X - parseInt(document.all.Win4.style.left) + 8; ss document.all.ZONE4.height = Y - parseInt(document.all.Win4.style.top) - 30; ss ControlNewSize(4); ss} ssif (window.top.test2_5.flag) ss{ ss document.all.ZONE5.width = X - parseInt(document.all.Win5.style.left) + 8; ss document.all.ZONE5.height = Y - parseInt(document.all.Win5.style.top) - 30; ss ControlNewSize(5); ss} ssif (window.top.test2_6.flag) ss{ ss document.all.ZONE6.width = X - parseInt(document.all.Win6.style.left) + 8; ss document.all.ZONE6.height = Y - parseInt(document.all.Win6.style.top) - 30; ss ControlNewSize(6); ss} ssif (window.top.test2_7.flag) ss{ ss document.all.ZONE7.width = X - parseInt(document.all.Win7.style.left) + 8; ss document.all.ZONE7.height = Y - parseInt(document.all.Win7.style.top) - 30; ss ControlNewSize(7); ss} ssif (window.top.test2_8.flag) ss{ ss document.all.ZONE8.width = X - parseInt(document.all.Win8.style.left) + 8; ss document.all.ZONE8.height = Y - parseInt(document.all.Win8.style.top) - 30; ss ControlNewSize(8); ss} ssif (window.top.test2_9.flag) ss{ ss document.all.ZONE9.width = X - parseInt(document.all.Win9.style.left) + 8; ss document.all.ZONE9.height = Y - parseInt(document.all.Win9.style.top) - 30; ss ControlNewSize(9); ss} ssif (window.top.test2_10.flag) ss{ ss document.all.ZONE10.width = X - parseInt(document.all.Win10.style.left) + 8; ss document.all.ZONE10.height = Y - parseInt(document.all.Win10.style.top) - 30; ss ControlNewSize(10); ss} } } tabSize = new Array(); sTabSize = new Array(); sTabSize[1] = 400; sTabSize[2] = 200; tabSize[1] = sTabSize; sTabSize = new Array(); sTabSize[1] = 500; sTabSize[2] = 250; tabSize[2] = sTabSize; sTabSize = new Array(); sTabSize[1] = 400; sTabSize[2] = 200; tabSize[3] = sTabSize; sTabSize = new Array(); sTabSize[1] = 200; sTabSize[2] = 150; tabSize[4] = sTabSize; sTabSize = new Array(); sTabSize[1] = 500; sTabSize[2] = 250; tabSize[5] = sTabSize; sTabSize = new Array(); sTabSize[1] = 600; sTabSize[2] = 350; tabSize[6] = sTabSize; sTabSize = new Array(); sTabSize[1] = 200; sTabSize[2] = 120; tabSize[7] = sTabSize; sTabSize = new Array(); sTabSize[1] = 200; sTabSize[2] = 200; tabSize[8] = sTabSize; sTabSize = new Array(); sTabSize[1] = 400; sTabSize[2] = 200; tabSize[9] = sTabSize; sTabSize = new Array(); sTabSize[1] = 400; sTabSize[2] = 200; tabSize[10] = sTabSize; function ControlNewSize(numWin) { if (eval("document.all.ZONE"+numWin+".width < " + tabSize[numWin][1])) sseval("document.all.ZONE"+numWin+".width = " + tabSize[numWin][1]); if (eval("document.all.ZONE"+numWin+".height < " + tabSize[numWin][2])) sseval("document.all.ZONE"+numWin+".height = " + tabSize[numWin][2]); eval("document.all.ZONE"+numWin+".style.width = document.all.ZONE"+numWin+".width + 'px'" ); eval("document.all.ZONE"+numWin+".style.height = document.all.ZONE"+numWin+".height + 'px'" ); } function init() { if (loadOK()) { ssstartMoveCompteurs(); } } function startMoveCompteurs() { if (loadOK()) { ssif (document.all.Compteur1.style.color != '#000000') ss{ ss document.all.Compteur1.style.color = '#000000'; ss document.all.Compteur2.style.color = '#AA0000'; ss} sselse ss{ ss document.all.Compteur1.style.color = '#AA0000'; ss document.all.Compteur2.style.color = '#000000'; ss} } setTimeout('startMoveCompteurs()', 1500); } <body bgcolor="#ffffff" marginwidth="0" marginheight="0" bottommargin=0 leftmargin=0 rightmargin=0 scroll=no topmargin="0" onmousemove ="Test?doMove(event.clientX, event.clientY):null;" ondragstart="return false;"> plus un tas de merde un peu partout ! :D |
JWhy | :lol:
oui, c'est clair, il est zarb M@nu ;) tu peux aussi faire onmouseover="mouse=1;" onmouseout="mouse=0;" si tu declares mouse en variable globale ! ca ressemble a un script qui tourne en continu (avec un setTimeOut par ex.) et qui affiche qqchose selon la position du curseur... c'est pourquoi, il est oblige de modifier une variable globale (mouse) qui determine ce qu'il doit afficher lors du changement de position ! dis, c'est ca, j'ai bon ? ;) edit: ah oui, c'est ca, j'avais pas lu tout le topic :o
|
k666 | t bizar comme gars, pourquoi tu fais pas plutôt
onmouseover="javascript:mouse(1);" onmouseout="javascript:mouse(0);" et pis kes tu veux faire avec cette fonction? que je puisse t d + |
M@nu | J'ai réussi !!! tout seul en plus :):):)
Donc, j'ai défini les variables comme ça : onmouseover="mouse1()" onmouseout="mouse0()" avec ces fonctions : function mouse1() {mouse=1} function mouse0() {mouse=0} et ça marche !!! si qq'1 a une meilleure idée...ça m'intéresse qd même... |
M@nu | autrement c'est possible de faire un truc comme ça :
<etc... onmouseover="mouse=1" onmouseout="mouse=0"> en ayant au préalable défini la fonction function xxx() { ssssif(mouse==1) ssss{ ssssssinstruction si souris dessusssss ssss} sssselse ssss{ ssssssinstruction si souris ailleurs ssss} } Le problème, c'est que mes variables ne sont pas définies... Comment on fait pour les définir avec les onmouseover et onmouseout ? Merci |
M@nu | si je veux faire ça, c'est pour n'utiliser qu'une seule fonction en fait, parce qu'elle doit se réactualiser tt le temps...
c'est pas clair, je sais... La deuxième solution, ce serait de pouvoir donner une autre instruction javascript dans le onmouseover... j'ai essayé ça mais ça marche pas : onmouseover="affiche(); setInterval("affiche()",10)" Bon, c'est un peu normal que ça ne marche pas (à cause des " ) Enfin, je suis pas un pro du javascript...HELP me !! |
M@nu | Comment on fait pour définir un onmouseover à l'intérieur même d'une fonction ?
par exemple, de dire à la fonction de faire tel truc si la souris est sur tel calque, et tel autre truc si elle ne l'est pas. Merci |