效果如上
其实这个只是 TextBox
加了个简单的自动打字功能
登入部落格 > 设计 > 添加 Html/Java Scrpt
<form name="news">
<textarea rows="1" style="border:3px double #000000;border-radius:7px;font-size:12px;font-family:century gothic;cursor:crosshair;" cols="30" name="news2" wrap="virtual"></textarea>
<script language="JavaScript">
var newsText = new Array();
newsText[0] = "内容 1";
newsText[1] = "内容 2";
newsText[2] = "内容 3";
newsText[3] = "内容 4";
newsText[4] = "内容 5";
newsText[5] = "内容 6";
newsText[6] = "内容 7";
var ttloop = 1; // Ulang Tulisan atau Tidak jika 1 = ya, 0 = tidak
var tspeed = 70; // Jalannya tulisan per milisekon (makin banyak makin lambat)
var tdelay = 1000; // Pergantian Kalimat
// ------------- CANNOT EDITING ------------- \
var dwAText, cnews=0, eline=0, cchar=0, mxText;
function doNews() {
mxText = newsText.length - 1;
dwAText = newsText[cnews];
setTimeout("addChar()",1000)
}
function addNews() {
cnews += 1;
if (cnews <= mxText) {
dwAText = newsText[cnews];
if (dwAText.length != 0) {
document.news.news2.value = "";
eline = 0;
setTimeout("addChar()",tspeed)
}
}
}
function addChar() {
if (eline!=1) {
if (cchar != dwAText.length) {
nmttxt = ""; for (var k=0; k<=cchar;k++) nmttxt += dwAText.charAt(k);
document.news.news2.value = nmttxt;
cchar += 1;
if (cchar != dwAText.length) document.news.news2.value += "_";
} else {
cchar = 0;
eline = 1;
}
if (mxText==cnews && eline!=0 && ttloop!=0) {
cnews = 0; setTimeout("addNews()",tdelay);
} else setTimeout("addChar()",tspeed);
} else {
setTimeout("addNews()",tdelay)
}
}
doNews()
</script>
</form>
--
border : 3px double #000000 : 框框厚度 , 框框种类 , 颜色代码
你也可以在 style=" 后面加入别的美化代码
字体影子 : text-shadow: 2px 2px 2px #cccccc;
框框影子 : box-shadow:2px 2px 2px #cccccc;
CSS 鼠标 : cursor:crosshair;
HELP HELP , Press A Nuffnang For Me ♥