尝试设置id = $x
-但失败!
<img src='images/Rename.png' id='".$x."' title='Create new item' border=0 width='20px' height='20px' class='item_create_button'>
$x
在a中,for()
所以它以1开头
用Firebug看着它-显示了id = 0
(但其ID = 1之前的行
现在,尝试(仅出于测试目的)将其设置为输入字段:
<input type=button id='".$x."' title='Create new item' border=0 width='20px' height='20px' class='item_create_button'>
它在Firebug中显示id = 1!
为什么我不能将img标签中的ID设置为任何值!
这是正确的语法,
for ($x=0; $x<100; $x++) {
echo "<input type=button id='".$x."' title='Create new item' border=0 width='20px' height='20px' class='item_create_button'>";
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句