Cet article décrit la simple implémentation des effets de fenêtre flottants par JS. Partagez-le pour votre référence, comme suit:
HTML PARTIE:
<! Doctype html public "- // w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <éad> <meta http-equiv = "contenu-type" content = "text / html; charset = utf-8" /> <tone> intr tiled document </tapie> <style type = "text / css"> * {margin: 0; 0; padding: 0;} a img {border: 0;} </ style> </ired> <body> <div style = "height: 2000px; background: #ccc; affiche: aucun;"> </div> <! - div id = "floatad" style = "position: fixe! Important; position: Absolute; _Top: EVC (document.DocumentElement. NO-REPAT; style = "width: 26px; hauteur: 26px; float: droit;"> </div> <div onclick = "open_online ();"> </div> </div> <div id = "floatside" style = "width: 141px; hauteur: 579px; position: fixe! importante; position: Absolue; _top: expression (évaluer. onClick = "open_online ();> </ div -> </ body> </html> <script type =" text / javascript "src =" online.js "> </ script>JS Partie:
// Document javascript // image publicitaire flottante var flodimg = "images / onlinesay.jpg"; // image de barre latérale flottante var floatsideImg = "images / onlinetel.gif"; // ouvrir la fonction de communication en ligne open_online () {{ Window.open ('http://p.qiao.baidu.com//im/index?siteid=7342332&ucid=7601325');} // Floating Advertising Document.Writeln ("<div id = /" floatAd / "style = /" position: fixe! _Top: EVC (document.DocumentElement. NO-REPERT; style = / "width: 487px; hauteur: 320px; float: droite; /" onclick = / "open_online (); /"> </div> "); document.writeln (" </ div> "); // flottebar document.writeln (" <div style = / "width: 141px; hauteur: 579px; position: fixe: fixe! _top: expression (évaluer. Fonction publicitaire Floating CloseFad () {document.getElementById ('floatad'). style.display = 'None';} // Open Floating Ad Function ShowFad () {document.getElementById ('floatad'). Style.display = 'Block';} // Floatad Flower '). 'Block';} // Ouvrez la fonction Window ShowFloat () {document.getElementById ('Floatad'). Style.display = 'Block';} // Ouvrez la fenêtre pendant 20 secondes et exécutez uniquement Settimeout UNE (ShowFad, 20000); // Ouvrir SetInterval (ShowFloat, 30000);Les rendus sont les suivants:
Pour plus d'informations sur le contenu lié à JavaScript, veuillez consulter les sujets de ce site: "Résumé de l'algorithme de traversée JavaScript et compétences", "Résumé des compétences JavaScript Switching Special Effects", "Résumé des effets spéciaux de la recherche JavaScript", "Résumé des erreurs de données javascript et compétences en algorithme "et" Résumé de l'utilisation de l'opération mathématique JavaScript "
J'espère que cet article sera utile à la programmation JavaScript de tous.