php网页的背景能够不用图片用代码展示特效吗? 我想把网页的背景图片替换成如代码展示的特效。

<html>
<head>
<style type="text/css">
body
{
background-color:#000000;
overflow:hidden;
margin:0;
}
</style>
</head>
<body>
<canvas id="q"></canvas>
<script>
var s = window.screen;
var width = q.width = s.width;
var height = q.height = s.height;
var letters = Array(256).join(1).split('');
var draw = function () {
q.getContext('2d').fillStyle='rgba(0,0,0,0.05)';
q.getContext('2d').fillRect(0,0,width,height);
q.getContext('2d').fillStyle='#00FF00';
letters.map(function(y_pos, index){
text = String.fromCharCode(34+Math.random()*33);
x_pos = index * 10;
q.getContext('2d').fillText(text, x_pos, y_pos);
letters[index] = (y_pos > 758 + Math.random() * 1e4) ? 0 : y_pos + 10;
q.getContext('2d').fillStyle='#00FF00';
});
};
setInterval(draw, 33);
</script>
</body>
</html>

不太明白你的意思,你都有代码了你吧你的代码嵌入到php网页中不就可以了。追问

不会嵌入。。

追答

我建议你学习下html相关内容,你这段代码就是一个style央视标签和一个script标签,你吧这两个标签粘贴到php文件的html代码段就可以了。

我建议你学习下html相关内容,你这段代码就是一个style央视标签和一个script标签,你吧这两个标签粘贴到php文件的html代码段就可以了。

追问

还是不会,把文件给你,方便帮忙加一下吗??

温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网