小编Aja*_*tta的帖子

如何显示openweathermap天气图标

我正在使用openweathermap显示天气预报.一切正常,但图标有问题.json响应代码是:

Array
(
    [city] => Array
        (
            [id] => 1271476
            [name] => Guwahati
            [coord] => Array
                (
                    [lon] => 91.751
                    [lat] => 26.1862
                )

            [country] => IN
            [population] => 899094
        )

    [cod] => 200
    [message] => 0.0630711
    [cnt] => 1
    [list] => Array
        (
            [0] => Array
                (
                    [dt] => 1495688400
                    [temp] => Array
                        (
                            [day] => 33
                            [min] => 24.89
                            [max] => 33.82
                            [night] => 24.89
                            [eve] => 30.6
                            [morn] => 33
                        )

                    [pressure] => 1013.02
                    [humidity] => 90 …
Run Code Online (Sandbox Code Playgroud)

html json openweathermap

9
推荐指数
5
解决办法
2万
查看次数

使用 jquery 对一行中所有文本框值的总和

我想使用 jQuery 对 html 表行中的所有文本框值求和。这是表:

<table border="1">
  <tr>
      <th>sl</th>
      <th>TA</th>
      <th>DA</th>
      <th>HA</th>
      <th>Total</th>
  </tr>
  <tr>
      <td>1</td>
      <td><input class="expenses"></td>
      <td><input class="expenses"></td>
      <td><input class="expenses"></td><td>
      <input id="expenses_sum"></td>
  </tr>
  <tr>
      <td>2</td>
      <td><input class="expenses"></td>
      <td><input class="expenses"></td>
      <td><input class="expenses"></td><td>
      <input id="expenses_sum"></td>
  </tr>
  <tr>
      <td>3</td>
      <td><input class="expenses"></td>
      <td><input class="expenses"></td>
      <td><input class="expenses"></td><td>
      <input id="expenses_sum"></td>
  </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

下面是jQuery函数,用于将所有类费用文本框的值相加,并将结果显示在一个id为费用总和的文本框中。

$(document).ready(function() {    
  $(".expenses").each(function() {    
    $(this).keyup(function() {     
      calculateSum();
    });
  });
});    

function calculateSum() {    
  var sum = 0;        
  $(".expenses").each(function() {          
    if (!isNaN(this.value) && this.value.length != 0) {
      sum += parseFloat(this.value);
    }    
  }); …
Run Code Online (Sandbox Code Playgroud)

html javascript php jquery

2
推荐指数
1
解决办法
1万
查看次数

使用javascript删除谷歌地图路径中的直线

Requerment是在谷歌地图上使用多个路点在起始位置和结束位置之间绘制路径.路径很好,但问题是坐标之间有几条直线.如何删除坐标之外的额外直线?

我的代码如下

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
    var markers = [
            {
                "title": 'A',
                "lat": '26.3489',
                "lng": ' 92.6845',
                "description": 'A'
            }
        ,
            {
                "title": 'B',
                "lat": '26.3546',
                "lng": '92.6902',
                "description": 'B'
            }
       ,
            {
                "title": 'D',
                "lat": '26.3508',
                "lng": '92.7102',
                "description": 'D'
            }

         ,
            {
                "title": 'E',
                "lat": '26.4285',
                "lng": '92.8497',
                "description": 'E'
            } 
        ,
          {
              "title": 'E',
              "lat": '26.5486',
              "lng": '92.9008',
              "description": 'E'
          } 
        ,
          {
              "title": 'E',
              "lat": ' 26.6567',
              "lng": '92.7717',
              "description": 'E'
          } 

         ,
            { …
Run Code Online (Sandbox Code Playgroud)

javascript google-maps google-maps-api-3

0
推荐指数
1
解决办法
1342
查看次数