To achieve urban air quality index queries (not including automatic data acquisition)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>of the typethe INPUT<
    City:= "text" ID = "City" name = "City" > < br > 
    Air Quality: < P ID = "AQI" > </ P > 
    < Script > 
        var ARRY = [[ " Beijing " , 100 ], [ " Shanghai " , 90 ], [ " Dalian " , 50 ], [ " Shenyang " , 90 ]];
         var ocity = Document.getElementById("city");
        var oaqi = document.getElementById("aqi");
        ocity.onblur = function(){
            for(i=0;i<arry.length;i++){
                if(arry[i][0] == ocity.value){
                    oaqi.innerHTML= arry[i][1];
                    break;
                }else{oaqi.innerHTML = "Please enter a city name! " ;} 
                
            } 
        } 
    </ Script > 
</ body > 
</ HTML >

 

Guess you like

Origin www.cnblogs.com/wangbingblog/p/11343675.html