国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

javascript實現的固定位置懸浮窗口實例

2024-05-06 16:19:01
字體:
來源:轉載
供稿:網友

這篇文章主要介紹了javascript實現的固定位置懸浮窗口,以一個完整實例形式詳細分析了javascript實現固定位置懸浮窗口的相關技巧,非常具有實用價值,需要的朋友可以參考下

本文實例講述了javascript實現的固定位置懸浮窗口。分享給大家供大家參考。具體實現方法如下:

 

 
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  3. <html xmlns="http://www.w3.org/1999/xhtml"> 
  4. <head> 
  5. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
  6. <title>Fixed固定位置的懸浮</title> 
  7. <style> 
  8. * { font-size:12px; font-family:Verdana,宋體; } 
  9. html, body { margin:0px; padding:0px; overflow:hidden; } 
  10. .b { margin:0px; padding:0px; overflow:auto; } 
  11. .line0 { line-height:20px; background-color:lightyellow; 
  12. padding:0px 15px; } 
  13. .line1 { line-height:18px; background-color:lightblue; 
  14. padding:0px 10px; } 
  15. .w { position:absolute; right:10px; bottom:10px; width:160px;  
  16. height:240px; overflow:hidden; border:2px groove #281; 
  17. cursor:default; -moz-user-select:none; } 
  18. .t { line-height:20px; height:20px; width:160px; 
  19. overflow:hidden; background-color:#27C; color:white; 
  20. font-weight:bold; border-bottom:1px outset blue; 
  21. text-align:center; } 
  22. .winBody { height:218px; width:160px; overflow-x:hidden; 
  23. overflow-y:auto; border-top:1px inset blue; 
  24. padding:10px; text-indent:10px; background-color:white; 
  25. </style> 
  26. </head> 
  27. <body> 
  28. <div class="w"> 
  29. <div class="t">Demo Win - Fixed</div> 
  30. <div class="winBody">Hello world</div> 
  31. <div>http://www.survivalescaperooms.com/</div> 
  32. </div> 
  33. </body> 
  34. <script> 
  35. //測試用,隨機產生一定的內容 
  36. for(var i=0; i<400; i++)document.write("<div class=/"line"+(i%2)+"/">"+(new Array(20)).join((Math.random()*1000000).toString(36)+" ")+"<//div>"); 
  37. //代碼如下: 
  38. new function(w,b,c,d,o){ 
  39. d=document;b=d.body;o=b.childNodes;c="className"
  40. b.appendChild(w=d.createElement("div"))[c]= "b"; 
  41. for(var i=0; i<o.length-1; i++)if(o[i][c]!="w")w.appendChild(o[i]),i--; 
  42. (window.onresize = function(){ 
  43. w.style.width = d.documentElement.clientWidth + "px"; 
  44. w.style.height = d.documentElement.clientHeight + "px"; 
  45. })(); 
  46. </script> 
  47. </html> 

希望本文所述對大家的javascript程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 张家港市| 琼海市| 承德县| 小金县| 涞水县| 沙田区| 常宁市| 广昌县| 洪泽县| 凌源市| 周宁县| 阳新县| 勃利县| 孟州市| 扎鲁特旗| 丹巴县| 泽库县| 桓台县| 武夷山市| 鞍山市| 嘉鱼县| 施秉县| 九台市| 沽源县| 祁阳县| 西平县| 乌兰浩特市| 张北县| 乃东县| 吉水县| 侯马市| 蛟河市| 丰顺县| 卓资县| 保康县| 屏东市| 略阳县| 浮山县| 冀州市| 台东县| 麟游县|