rayanehkhabar
Member
سلام. یک اسکریپت یا کد جاوا می خواستم که به صورت تصادفی یک متن را در صفحه سایت به نمایش دربیاره. مثلا نمایش سخن روز ...
document.getElementById('idiejaiikemikhaionjaneshonbedi').innerHTML=texts[rt]
<script language="javascript">
var texts = new Array()
texts[1] = "متن 1";
texts[2] = "متن 2";
texts[3] = "متن 3";
var rt = Math.floor(Math.random() * texts.length)
if (rt == 0) { rt = 1 }
document.getElementById('idiejaiikemikhaionjaneshonbedi').innerHTML=texts[rt]
</script>
<script language="JavaScript">
var Quotation=new Array()
Quotation[0] = "سخن 1";
Quotation[1] = "سخن 2";
Quotation[2] = "سخن 3";
Quotation[3] = "سخن 4";
Quotation[4] = "سخن 5";
var Q = Quotation.length;
var whichQuotation=Math.round(Math.random()*(Q-1));
function showQuotation(){document.write(Quotation[whichQuotation]);}
showQuotation();
</script>
if (date('y-m-d')=='2008-11-24') echo 'hello, world!';
<?php
if (date('y-m-d')=='2008-11-25') echo 'حدیث امروز یک';
if (date('y-m-d')=='2008-11-26') echo 'حدیث امروز دو';
?>
$query = mysql_query("SELECT * FROM `your table` LIMIT 0,1 Order By RAND()");