欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Js經(jīng)典案例的實例代碼

 更新時間:2018年05月10日 10:57:41   作者:haitaodoit  
JS實現(xiàn)鼠標(biāo)懸停切換圖片,顯示天氣預(yù)報,利用焦點實現(xiàn)選擇網(wǎng)站的實例代碼,具有很好的參考價值,希望對大家有所幫助,一起跟隨小編過來看看吧

本文講述了JS實現(xiàn)鼠標(biāo)懸停切換圖片,顯示天氣預(yù)報,利用焦點實現(xiàn)選擇網(wǎng)站的實例代碼,分享給大家供大家參考,具體如下:

鼠標(biāo)懸停切換圖片:

<html>
<head>
<script type="text/javascript">
function mouseOver()
{
document.getElementById('b1').src ="diaochan.jpg"
}
function mouseOut()
{
document.getElementById('b1').src ="noimage.gif"
}
</script>
</head>
<body>
<a href="#" 
onmouseover="mouseOver()" onmouseout="mouseOut()">
<img alt="Visit W3School!" src="noimage.gif" id="b1" onmouseover="alert('你的鼠標(biāo)在圖片上!')")/>
</a>
</body>
</html>

js顯示天氣預(yù)報:

<html>
<head><title></title>
<script type="text/javascript">
</script>
</head>
<body >
<div>
<iframe src="http://m.weather.com.cn/m/pn11/weather.htm" width="480" height="70" frameborder="1"></iframe>
</div>
</body>
</html>

js利用焦點實現(xiàn)選擇網(wǎng)站:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <title></title>
 <script type="text/javascript">
  var i = 1;
  var focusid;
  function defau() {
   document.getElementById('1').focus();
   focusid=1;
  }
  function showtable() {
   var id = i + 1;
   document.getElementById(id).focus();
   focusid=id;
   i++;
   if (i == 4) {
    i = 0;
   }
  }
  function openhref() {
   var href = document.getElementById(focusid).href;
   document.location = href;
  }
 </script>
</head>
<body onload="defau()">
<a  id="1">百度</a>
<a  id="2">谷歌</a>
<a  id="3">優(yōu)酷</a>
<a  id="4">土豆</a>
 <input id="Button1" type="button" value="選擇" onclick="showtable()" /><br />
 <input id="Button2" type="button" value="進(jìn)入" onclick="openhref()" />
</body>
</html>

以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,如果有疑問大家可以留言交流,謝謝大家對腳本之家的支持。

相關(guān)文章

最新評論