This article example tells the example of JS implementing cool water wave text special effects. Share it for your reference. The specific implementation method is as follows:
Copy the code as follows: <html>
<head>
<title>JS implements cool water wave text effects</title>
</head>
<body bgcolor="#000000" onLoad="if (document.all)wave()">
<center>
<div id='water' style='position:relative;width:400px;height:150px;font-family:Verdana;font-size:50px;color:#8080ff'>
</div>
</center>
<script language="javascript">
<!--
if (document.layers){ //If it is NS
alert("Your browser does not support this special effect"); // Make a prompt
}
else //Otherwise (not NS)
if (document.all){ //If it is IE
var step=3; //Set the step length of the change effect
var xstep=0;
var msg='Welcome<br>Wulin.com<br>jb51.cn';
water.innerHTML=msg //Set the content of the effect layer
function wave(){
//This sentence is used to set the style of the layer, where the phase attribute of the filter is dynamically set according to the value of xstep.
document.all.water.style.filter='wave(freq=3, strength=5, phase='+xstep+', lightstrength=45, add=0, enabled=1)';
xstep+=step;
//Change the value of xstep according to the step value, so that the ripple angle changes slightly the next time the layer style is refreshed
TIMER=setTimeout('wave()',10);//Set the delay for the next change
}
}
//-->
</script>
</html>
I hope this article will be helpful to everyone's JavaScript programming.