首页前端开发CSSTypewriter Simulation

Typewriter Simulation

时间2024-05-27 01:30:04发布访客分类CSS浏览129
导读:HTML 文件中有一个 元素,它为 id 为 "typing" 的元素定义了一个行为: #typing { behavior:url(behave_typing.htc ; font-family:'courier new'; }...

HTML 文件中有一个 元素,它为 id 为 "typing" 的元素定义了一个行为:




#typing
{
    
behavior:url(behave_typing.htc);
    
font-family:'courier new';

}
    



IE5 introduced DHTML behaviors.
Behaviors are a way to add DHTML functionality to HTML elements
with the ease of CSS.

How do behaviors work?
By using XML we can link behaviors to any element in a web page and manipulate that element.

下面是 XML 文档 "behave.htc":




var i,text1,text2,textLength,t;

function beginTyping()
{
    
i=0;
    
text1=element.innerText;
    
textLength=text1.length;
    
element.innerText="";
    
text2="";
    
t=window.setInterval(element.id+".type()",speed);

}

function type()
{
    
text2=text2+text1.substring(i,i+1);
    
element.innerText=text2;
    
i=i+1;

if (i==textLength)
  {
    
  clearInterval(t);

  }

}
    

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: Typewriter Simulation
本文地址: https://pptw.com/jishu/668858.html
美国服务器WAF防火墙的功能是什么 美国服务器CPU跟普通PC端CPU的区别是什么

游客 回复需填写必要信息