萬盛學電腦網

 萬盛學電腦網 >> 腳本專題 >> javascript >> jquery $(#variable) 循環改變variable的值示例

jquery $(#variable) 循環改變variable的值示例

 這篇文章主要介紹了jquery $("#variable")如何循環改變variable的值,需要的朋友可以參考下

直接看例子   代碼如下: for(var p=1; p<=5; p++){  $("#properties"+p).show();  //下面有五個id為properties1 、properties2 、properties3 、properties4、properties5的div  //我們用一個語句就讓下面五個div顯示成功了。  }  }  <div class="banner" id="properties1">  <span>【${property1 }】</span>  <div id="property1" class="bannerchild"></div>  </div>  <div class="banner" id="properties2">  <span>【${property2 }】</span>  <div id="property2" class="bannerchild"></div>  </div>  <div class="banner" id="properties3">  <span>【${property3 }】</span>  <div id="property3" class="bannerchild"></div>  </div>  <div class="banner" id="properties4">  <span>【${property4 }】</span>  <div id="property4" class="bannerchild"></div>  </div>  <div class="banner" id="properties5">  <span>【${property5 }】</span>  <div id="property5" class="bannerchild"></div>  </div>   
copyright © 萬盛學電腦網 all rights reserved