用PHP+java實現自動新聞滾動視窗

來源:互聯網
上載者:User

show.php原始碼:
<?
if ($action=="cp"){
echo"<div align=center>
<p>滾動菜單資料輸入端</p>
<form method=post action=show.php?action=edit>
<p>文字一:
<input type=text name=t1 maxlength=30>
連結一:
<input type=text name=l1 maxlength=50>
</p>
<p>文字二:
<input type=text name=t2 maxlength=30>
連結二:
<input type=text name=l2 maxlength=50>
</p>
<p>文字三:
<input type=text name=t3 maxlength=30>
連結三:
<input type=text name=l3 maxlength=50>
</p>
<p>文字四:
<input type=text name=t4 maxlength=30>
連結四:
<input type=text name=l4 maxlength=50>
</p>
<p>文字五:
<input type=text name=t5 maxlength=30>
連結五:
<input type=text name=l5 maxlength=50>
</p>
<p>
<input type=submit name=Submit value=提交>
<input type=submit name=Submit2 value=重寫>
</p>
</form>
</div>";exit;}
if ($action=="edit"){
$wname="data.txt";#資料儲存檔案,屬性666
$writeurl="<a href=$l1>$t1<\/a><br><br><a href=$l2>$t2<\/a><br><br><a href=$l3>$t3<\/a><br><br><a href=$l4>$t4<\/a><br><br><a href=$l5>$t5<\/a><br><br>";
$fp=fopen($wname,"w");
$ww=fputs($fp,$writeurl);
if ($ww){echo 檔案寫入成功;}else{echo 寫入失敗;}
exit;}
$wname="php-bin/data.txt";#由於是在頁面調用,這裡必須填寫頁面和程式相對路徑或者絕對路徑!
$fa=fopen($wname,"r+");
$wwww=fread($fa,filesize($wname));
echo "<table border= \"0\" bgcolor=\"#A8EB9B\" cellpadding=\"1\" cellspacing= \"0\" width=129><TR><TD><table bgcolor=\"#FFFFFF\" cellpadding=\"5\" cellspacing=\"0\" width=129 border=\"0\" VALIGN=\"Top\"><tr><td><script language=\"JavaScript1.2\">
var marqueewidth=118
var marqueeheight=104
var speed=1
var marqueecontents='$wwww'
if (document.all)
document.write('<marquee direction=\"up\" scrollAmount='+speed+' style=\"width:'+marqueewidth+';height:'+marqueeheight+'\">'+marqueecontents+'</marquee>')
function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers){
setTimeout(\"window.onresize=regenerate\",450)
intializemarquee()
}
}
function intializemarquee(){
document.cmarquee01.document.cmarquee02.document.write(marqueecontents)
document.cmarquee01.document.cmarquee02.document.close()
thelength=document.cmarquee01.document.cmarquee02.document.height
scrollit()
}
function scrollit(){
if (document.cmarquee01.document.cmarquee02.top>=thelength*(-1)){
document.cmarquee01.document.cmarquee02.top-=speed
setTimeout(\"scrollit()\",100)
}
else{
document.cmarquee01.document.cmarquee02.top=marqueeheight
scrollit()
}
}
window.onload=regenerate2
</script><ilayer width=&{marqueewidth}; height=&{marqueeheight}; name=\"cmarquee01\"><layer name=\"cmarquee02\" width=&{marqueewidth}; height=&{marqueeheight};></layer></ilayer></tr></table></TD></TR></TABLE>";
?>

使用時先要建立一個名為data.txt的空白檔案放在show.php的同一級目錄下,然後在頁面裡使用include調用即可!
show.php?action=cp及可以進行設定,當然,因為沒有密碼保護,你可以把cp改成其他文字!

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.