W3.JS Http

2020-11-05 17:02 更新

從服務(wù)器讀取數(shù)據(jù):

w3.getHttpObject(file.js,function)
這個(gè)頁(yè)面上的示例與上一個(gè)頁(yè)面上的示例相同,除了數(shù)據(jù)是從web服務(wù)器請(qǐng)求的:customers.js

填充下拉

實(shí)例

<select id="id01">
  <option w3-repeat="customers">{{CustomerName}}</option>
</select>
<script>
w3.getHttpObject("
https://7npmedia.w3cschool.cn/customers1.js", myFunction);
function myFunction(myObject) {
  w3.displayObject("id01", myObject);
}
</script>

嘗試一下 ?   添加上CSS ? ?

填充列表

實(shí)例

<ul id="id01">
  <li w3-repeat="customers">{{CustomerName}}</li>
</ul>

嘗試一下 ?   添加上CSS ??

填充表格

實(shí)例

<table id="id01">
<tr><th>Customer</th><th>City</th><th>Country</th></tr>
<tr w3-repeat="customers"><td>{{CustomerName}}</td><td>{{City}}</td><td>{{Country}}</td></tr>
</table>

嘗試一下 ?   添加上CSS ? ?

填充另一個(gè)表

實(shí)例

<table id="id01">
<tr><th>Title</th><th>Artist</th><th>Price</th></tr>
<tr w3-repeat="cd"><td>{{title}}</td><td>{{artist}}</td><td>{{price}}</td></tr>
</table>

嘗試一下 ?   添加上CSS ? ?


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)