Merci à tous de m'avoir aidé avec mes problèmes Javascripting. Mon problème actuel est que je dois ouvrir & fermer une nouvelle fenêtre sur onMouseOver & onMouseOut, respectivement, mais si la nouvelle fenêtre onMouseOver == true alors je ne veux pas que la nouvelle fenêtre se ferme.Javascript: ouvrir une nouvelle fenêtre sur onMouseOver & onMouseOut, mais seulement si new window onMouseOver = true
Je suis sûr qu'il existe une solution simple, mais je n'arrive pas à trouver un moyen d'annuler l'image onMouseOut = "closeDetails();" si l'utilisateur passe la souris sur la nouvelle fenêtre. Voici la plupart du code que je traite. Merci d'avance pour votre aide.
<body>
<img name="img1" id="img1" onMouseOver="windowDelay(this);"
onMouseOut="closeDetails();" src="images/127.jpg" height="240" width="166"/>
</body>
<script language="JavaScript" type="text/javascript">
// This opens the movie details pop-up after an
// half second interval.
function windowDelay(thatImg)
{
winOpenTimer = window.setTimeout(function() {openDetails(thatImg);}, 2000);
}
// This is the function that will open the
// new window when the mouse is moved over the image
function openDetails(thatImg)
{
// This creates a new window and uses the hovered image name as the window
// name so that it can be used in the that window's javascript
newWindow = open("", thatImg.name,"width=400,height=500,left=410,top=210");
// open new document
newWindow.document.open();
// Text of the new document
// Replace your " with ' or \" or your document.write statements will fail
newWindow.document.write("<html><head><title>Movies</title>");
newWindow.document.write("<script src='myDetails.js' type='text/javascript'>");
newWindow.document.write("</script></head>");
newWindow.document.write("<body bgcolor='white' onload='popUpDetails();'>");
newWindow.document.write("... SOME OTHER HTML....");
newWindow.document.write("</body></html>");
// close the document
newWindow.document.close();
}
// This is the function that will call the
// closeWindow() after 2 seconds
// when the mouse is moved off the image.
function closeDetails()
{
winCloseTimer = window.setTimeout("closeWindow();", 2000);
}
// This function closes the pop-up window
// and turns off the Window Timers
function closeWindow()
{
// If popUpHover == true then I do not want
// the window to close
if(popUpHover == false)
{
clearInterval(winOpenTimer);
clearInterval(winCloseTimer);
newWindow.close();
}
}
function popUpDetails()
{
// This will be used to prevent the Details Window from closing
popUpHover = true;
// Below is some other javascript code...
}
</script>
Une fenêtre pop-up pour une info-bulle de fantaisie? yikes! Pop up bloqueurs bloquera cela! Utilisez les info-bulles Ajax. – epascarello
Je ne suis pas encore familier avec Ajax. Cependant, c'est plus qu'une infobulle et elle fournira des informations utiles pour mon usage personnel. Si ce n'est pas faisable en Javascript alors je vais apprendre et utiliser Ajax, mais je préférerais une solution en javascript. – yerty