Cet article décrit la méthode de JS pour déplacer l'image d'arrière-plan dans la page Web de manière diagonale. Partagez-le pour votre référence. La méthode de mise en œuvre spécifique est la suivante:
Copiez le code comme suit: <html>
<adal>
<Title> JS implémente l'image d'arrière-plan Web pour déplacer obliquement </Title>
<Body Background = "Images / Changshi.ico">
<script linguisse = "javascript">
<! -
fonction selectall (thefield) {
var tempval = eval ("document". + thefield)
tempval.focus ()
tempval.select ()
}
// ->
</cript>
<script linguisse = "javascript">
<! -
var background = "images / changshi.ico";
Var Speed = 0;
Browsername = Navigator.AppNAME;
Browserver = paSeInt (Navigator.Appversion);
if (Browsername! = "NetScape" || Browserver> = 4.5) {
fonction moveback (Movenn, HPOS, VPOS) {
if (arguments [4])
document.body.style.backgroundMage = "URL (/" "+ arguments [4] +" / ")";
si (arguments [5])
document.body.style.backgroundrepeat = arguments [5]
if (! Isnan (hpos)) {
if ((movert! = 0) && (hpos> 0)) HPOS = -100000
HPOS + = bouger
}
if (! Isnan (VPOS)) {
if ((movyn! = 0) && (vpos> 0)) VPOS = -100000
VPOS + = MOTIONN
}
document.body.style.backgroundPosition = HPOS + "" + VPOS
if (isnan (hpos)) hpos = "/" "+ hpos +" / ""
if (isnan (vpos)) vpos = "/" "+ vpos +" / ""
setTimeout ("moveback (" + movvert + "," + movyn + "," + hpos + "," + vpos + ")", vitesse)
}
Moveback (1,1,0,0, arrière-plan);
}
// ->
</cript>
</docy>
</html>
J'espère que cet article sera utile à la programmation JavaScript de tous.