We have learnt how to set password for the web page in the last article. It needs the help of HTML codes. It is same with the ways to set password for the web page. We also need to use HTML codes to make the image show as water wave shape.
This special effect makes the web page full of livingness and vitality. Besides, it can attract viewers to pay attention. Now let us learn how to make the image show as water shape. Follow me step by step. Maybe the codes are a little difficult.
|
First, open the finished web page. Or build a new blank web page.
Second, click the code button, and open the code view. Put the following text codes in to the section between <body> and </body>.
- <script language="JavaScript">
- var imgsname = new Array()
- imgsname[0]="images/fsy00966.jpg"
- // the links of your images
- var imgsurl = new Array()
- imgsurl[0]="http://123.com"
- var linktarget="_blank"
- var pause=3
- var posleft=305
- var postop=530
- var contentimage=""
- var i_image=0
- var i_stepwave=0
- var i_maxstepwave=40
- var imgpreload=new Array()
- for (i=0;i< =imgsname.length-1;i++) {
- imgpreload[i]=new Image()
- imgpreload[i].src=imgsname[i]
- }
- pause=pause*1000
- function initiate() {
- contentimage="<a href='"+imgsurl[i_image]+"' target='"+linktarget+"'><img src='"+imgsname[i_image]+"' border='0'/>"
- if (document.all) {
- waveimage.innerHTML=contentimage
- waveimage.style.posLeft=posleft
- waveimage.style.posTop=postop
- enlargewave()
- }
- if (document.layers) {
- document.waveimage.left=posleft
- document.waveimage.top=postop
- changeimage()
- }
- }
- function enlargewave() {
- if (i_stepwave< =i_maxstepwave) {
- waveimage.filters.wave.phase=i_stepwave
- waveimage.filters.wave.strength=i_stepwave
- waveimage.filters.wave.lightstrength=i_stepwave
- waveimage.filters.wave.freq=i_stepwave
- i_stepwave++
- var timer=setTimeout("enlargewave()",50)
- }
- else {
- clearTimeout(timer)
- changeimage()
- }
- }
- function reducewave() {
- if (i_stepwave>0) {
- waveimage.filters.wave.phase=i_stepwave
- waveimage.filters.wave.strength=i_stepwave
- waveimage.filters.wave.lightstrength=i_stepwave
- waveimage.filters.wave.freq=i_stepwave
- i_stepwave--
- var timer=setTimeout("reducewave()",50)
- }
- else {
- clearTimeout(timer)
- var timer=setTimeout("enlargewave()",pause)
- }
- }
- function changeimage() {
- i_image++
- if (i_image>=imgsname.length) {i_image=0}
- contentimage="<a href='"+imgsurl[i_image]+"' target='"+linktarget+"'><img src='"+imgsname[i_image]+"' border='0'/></a>"
- if (document.all) {
- waveimage.innerHTML=contentimage
- reducewave()
- }
- if (document.layers) {
- document.waveimage.document.write(contentimage)
- document.waveimage.document.close()
- var timer=setTimeout("changeimage()",pause)
- }
- }
- if (document.all) {
- document.write('<div ID="waveimage" style="position:absolute; filter:wave();"> </div>')
- }
- if (document.layers) {
- document.write('<layer NAME="waveimage"></layer>')
- document.close()
- }
- window.onload=initiate
- </script>
We use the enlargewave and reducewave function to define the change of the image’s wave. And we use the time function to define the time of the wave’s circle. The layer is to insert the image with water wave effect. Then the width, height, top and left will change according to the function. At last, the image with water wave effect is OK.
Third, go back to the design view. Save the document and preview the web page in the Internet Explorer. The effect is like the following picture.
|
Does it look like dynamic? However, unless you want to the viewers to pay attention this image especially, you’d better not use this effect. If your website is built for serious information such as government, hospital, the image with wave effect will destroy seriousness. Of course, the image with wave effect will be liked by children. The HTML codes are a little difficult. Don’t worry. you just need to understand the meaning of the codes instead of remembering all the codes.

