//定义一个常量,以引用各个页面的单独css文件
如index.php页面调用时,href="style/1/ <?php echo SCRIPT; ?> .css",用的是index.css文件.
register.php页面调用时,href="style/1/ <?php echo SCRIPT; ?> .css",用的是register.css文件.
2、
展示头像的for循环:
<dl>
<?php for($i=1;$i<10;$i++){?><dd><img src="face/m0<?php echo $i?>.gif" alt="头像" /></dd> <?php }?>
</dl>
展示头像的foreach循环:
<dl>
<?php foreach(range(1,9) as $num){?><dd><img src="face/m0<?php echo $num?>.gif" alt="头像<?php echo $num?>" /></dd>
<?php }?></dl>
<dl>
细节:echo range(1,9); 错误,Notice: Array to string conversion in I:\wamp\www\TestGuest0.5\face.php on line 13 Call Stack
Notice: Array to string conversion in I:\wamp\www\TestGuest0.5\face.php on line 13 | ||||
---|---|---|---|---|
Call Stack |
print_r (range(1,9));正确,输出:Array( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 8 [8] => 9)
foreach(range(1,9) as $number){
echo $number;
}//输出:123456789
3、
//等待网页加载完毕再执行
window.onload=function(){
var faceimg=document.getElementById('faceimg');
faceimg.onclick=function(){
window.open('face.php','face','width=501,height=400,top=100,left=10,scrollbars=1');
}
};
onclick 打成onclik······找了一个多小时找不到···我也是醉了·~~~~~~