国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

做網(wǎng)頁的一些技巧(續(xù))

2019-11-21 02:18:22
字體:
供稿:網(wǎng)友

Q: 實(shí)現(xiàn)雙擊自動(dòng)滾屏.
A: 將以下代碼添加到需要自動(dòng)滾屏的頁面上

<s cript Language="Javas cript">
var currentpos, timer;
function initialize(){
timer = setInterval("scrollwindow()", 1);
}
function sc(){
clearInterval(timer);
}
function scrollwindow(){
currentpos = document.body.scrollTop;
window.scroll(0, ++currentpos);
if(currentpos != document.body.scrollTop){
sc();
}
}
document.onmousedown = sc;
document.ondblclick = initialize;
</s cript>

Q: 鼠標(biāo)特效 。
A: 鼠標(biāo)放到鏈接上就會(huì)出現(xiàn)一個(gè)說明框,里面有滾動(dòng)的文字說明

<a target="_blank" onMouseOver="helpor_net_show(this,event,' 這里是小郭的個(gè)人主頁 ')" onMouseOut="helpor_net_hide()"> 把鼠標(biāo)放上來試試
<div id="tooltip2" style="position:absolute;visibility:hidden;clip:rect(0 150 50 0);width:150px;background-color:seashell">
<layer name="nstip" width="1000px" bgColor="seashell"></layer>
</div>
<SCRIPT language="JavaScript">
<!--
if (!document.layers&&!document.all)
event="test"
function helpor_net_show(current,e,text){

if (document.all&&document.readyState=="complete"){
document.all.tooltip2.innerHTML='<marquee style="border:1px solid #3399ff">'+text+'</marquee>'
document.all.tooltip2.style.pixelLeft=event.clientX+document.body.scrollLeft+10
document.all.tooltip2.style.pixelTop=event.clientY+document.body.scrollTop+10
document.all.tooltip2.style.visibility="visible"
}

else if (document.layers){
document.tooltip2.document.nstip.document.write(' '+text+' ')
document.tooltip2.document.nstip.document.close()
document.tooltip2.document.nstip.left=0
currentscroll=setInterval("scrolltip()",100)
document.tooltip2.left=e.pageX+10
document.tooltip2.top=e.pageY+10
document.tooltip2.visibility="show"
}
}
function helpor_net_hide(){
if (document.all)
document.all.tooltip2.style.visibility="hidden"
else if (document.layers){
clearInterval(currentscroll)
document.tooltip2.visibility="hidden"
}
}

function scrolltip(){
if (document.tooltip2.document.nstip.left>=-document.tooltip2.document.nstip.document.width)
document.tooltip2.document.nstip.left-=5
else
document.tooltip2.document.nstip.left=150
}
//-->
</SCRIPT>

Q: 文本隨機(jī)輸出,可以用來作公告欄 。
A: 腳本說明 :
第一步 : 把如下代碼加入 <head> 區(qū)域中
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Tarjei Davidsen (the@rescueteam.com) -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
var max=0;
function textlist() { i++:textlist.arguments[i]; max }
tl = new textlist(
" 隨著 INTERNET 時(shí)代的逐步到來 , 人們對(duì)網(wǎng)絡(luò)的認(rèn)識(shí)與感知越來越深刻 ",
" 上網(wǎng)主要是進(jìn)行 web 頁面瀏覽,所以 web 頁面的精彩程度對(duì)一個(gè)網(wǎng)站的生 ",
" 人通過制作個(gè)人主頁展現(xiàn)自己的才華,而且,由于出現(xiàn)了多種制作網(wǎng)頁的軟件 ",
" 但是,光用軟件就成制作出你想要的各種頁面效果嗎?答案肯定是否定的但是,光用軟件就成制作出你想要的各種頁面效果嗎?答案肯定是否定的 ",
"JavaScript 是 Netscape( 網(wǎng)景 ) 公司首先推出的一種針對(duì) WEB 頁面的解釋型語 "
);

var x = 0; pos = 0;
var l = tl[0].length;
function textticker() {
document.tickform.tickfield.value = tl[x].substring(0, pos) + "_";
if(pos++ == l) {
pos = 0;
setTimeout("textticker()", 2000);
if(++x == max) x = 0;
l = tl[x].length;
} else
setTimeout("textticker()", 50);
}
// End -->
</script>
</HEAD>


第二步 : 把如下代碼加入 <body> 區(qū)域中
<form name=tickform>
<textarea name=tickfield rows=3 cols=38 style="background-color: rgb(0,0,0); color: rgb(255,255,255); cursor: default; font-family: Arial; font-size: 12px" wrap=virtual>The news will appear here when the page has finished loading.
</textarea>
</form>


第三步 : 把 <body> 改為
<body bgcolor="#fef4d9" OnLoad="textticker()">

Q: 進(jìn)入頁面自動(dòng)彈出的歡迎致詞,個(gè)人網(wǎng)站可加......
A: 今天在公司網(wǎng)站上抓的,進(jìn)入頁面自動(dòng)彈出的歡迎致詞,個(gè)人網(wǎng)站可加上不免沒有加好呀。加的位置應(yīng)該可以看懂吧。
<html>
<head>
</head>
<body>
</body>
<script language="vbscript">
<!--
MsgBox"歡迎光臨我的網(wǎng)站!"
-->
</script>
</html>

Q: 頁面自動(dòng)刷新說明 。
A: 當(dāng)你做網(wǎng)頁時(shí),是不是有的時(shí)候想讓你的網(wǎng)頁自動(dòng)不停刷新,或者過一段時(shí)間自動(dòng)跳轉(zhuǎn)到另外一個(gè)你自己設(shè)定的頁面?其實(shí)實(shí)現(xiàn)這個(gè)效果非常地簡單,而且這個(gè)效果甚至不能稱之為特效。你只要把如下代碼加入你的網(wǎng)頁中就可以了。

1,頁面自動(dòng)刷新:把如下代碼加入<head>區(qū)域中<meta http-equiv="refresh" content="20">,其中20指每隔20秒刷新一次頁面.

2,頁面自動(dòng)跳轉(zhuǎn):把如下代碼加入<head>區(qū)域中<meta http-equiv="refresh" content="20;url=http://www.163.com">,其中20指隔20秒后跳轉(zhuǎn)到http://www.163.com頁面。

Q: 鼠標(biāo)箭頭變十字架代碼(對(duì)一些特殊的網(wǎng)頁有用) .
A: 你們自己試試效果就知道了.

<script language="JavaScript1.2">
<!--
if (document.all&&!window.print){
leftright.style.width=document.body.clientWidth-2
topdown.style.height=document.body.clientHeight-2
}
else if (document.layers){
document.leftright.clip.width=window.innerWidth
document.leftright.clip.height=1
document.topdown.clip.width=1
document.topdown.clip.height=window.innerHeight
}
function followmouse1(){
//move cross engine for IE 4+
leftright.style.pixelTop=document.body.scrollTop+event.clientY+1
topdown.style.pixelTop=document.body.scrollTop
if (event.clientX<document.body.clientWidth-2)
topdown.style.pixelLeft=document.body.scrollLeft+event.clientX+1
else
topdown.style.pixelLeft=document.body.clientWidth-2
}
function followmouse2(e){
//move cross engine for NS 4+
document.leftright.top=e.y+1
document.topdown.top=pageYOffset
document.topdown.left=e.x+1
}
if (document.all)
document.onmousemove=followmouse1
else if (document.layers){
window.captureEvents(Event.MOUSEMOVE)
window.onmousemove=followmouse2
}
function regenerate(){
window.location.reload()
}
function regenerate2(){
setTimeout("window.onresize=regenerate",400)
}
if ((document.all&&!window.print)||document.layers)
//if the user is using IE 4 or NS 4, both NOT IE 5+
window.onload=regenerate2
//-->
</script>
<style>
<!--
#leftright, #topdown{
position:absolute;
left:0;
top:0;
width:1px;
height:1px;
layer-background-color:#B0D0F8;
background-color:#00eeff;
z-index:100;
font-size:1px;
}
-->
</style>

主站蜘蛛池模板: 济源市| 北京市| 武鸣县| 邵武市| 阜阳市| 临邑县| 武夷山市| 日照市| 桐庐县| 邵东县| 黔南| 中山市| 成武县| 新和县| 迭部县| 东丽区| 临漳县| 武山县| 施秉县| 阆中市| 绩溪县| 上栗县| 彭阳县| 仁化县| 海原县| 监利县| 班戈县| 临沂市| 凤冈县| 瑞丽市| 迁安市| 左贡县| 龙口市| 隆回县| 逊克县| 宝兴县| 蒙阴县| 双桥区| 边坝县| 龙里县| 尚义县|