PDA

View Full Version : سوال: اشکال در کار با یک تگِ script



maanib
پنج شنبه 05 فروردین 1389, 16:42 عصر
سلام! سال نو رو به همه دوستان شادباش میگم.
خواستم بدونم چطور میشه یک داده رو که از دیتابیس فراخوانی کردیم، بگذاریمش توی یک تگِ script بطوریکه بتونه اون داده رو هم نمایش بده؟
لطفا به دستور زیر یک نگاهی بندازید: ($typer[title] رو می خوام بگذارم توی این دستور اما پی اچ پی اونو نمی خونه. وقتی این کد رو توی قالب قرار میدم، نمی تونه لینکش کنه و میزنه undefined.)


$typer1 = mysql_query("SELECT * FROM articles ORDER BY date");
$typer = mysql_fetch_assoc($typer1);

<script>
<!--
function correct(){
if (finished){
setTimeout('begin()',3000)
}
return true
}
window.onerror=correct
function begin(){
if (!document.all)
return
if (maxheight==null)
maxheight=temp.offsetHeight
whatsnew.style.height=maxheight
temp.style.display='none'
c=1
finished=true
change()
}
//-->
</script>

<style>
<!--
#whatsnew a{color:730073;text-decoration:none}
#whatsnew, #temp {font-weight:bold; font-family:Arial}
#whatsnew a:hover{color:red}
-->
</style>
<script language=\&quot;javascript1.2\&quot;>
<!--
var head=''
var top=0
var maxheight
var finished=false
var tickers=new Array()
tickers&#91;0&#93;='<a href=\&quot;0.htm\&quot;>$typer&#91;title&#93;</a>' ==> inja ro manzuram hast bachehaa

for (i=1;i<=tickers.length-1;i++){
if (tickers&#91;i&#93;.length>=tickers&#91;top&#93;.length)
top=i
}
if (document.all)
document.write('<span id=\&quot;whatsnew\&quot; style=\&quot;width:100%;height=10;filter:revealTrans(du ration=2,transition=19)\&quot;>'+tickers&#91;0&#93;+'</span>')
function change(){
whatsnew.innerHTML=''
whatsnew.filters.revealTrans.apply()
whatsnew.filters.revealTrans.play()
whatsnew.innerHTML=tickers&#91;c&#93;
if (c==tickers.length-1)
c=0
else
c+=1
setTimeout('change()',5000)
}
if (document.all)
document.write('<span id=ns style=\&quot;display:none;\&quot;>')
//-->
</script>
<!--Insert alternate HTML codes here
that will be seen by browsers OTHER
than IE 4.x-->
</span>
<span id=temp style=\&quot;position:absolute;left:0;top:0\&quot; style=&{head};>
<script>
<!--
if (document.all){
temp.style.width=whatsnew.style.width
document.write(tickers&#91;top&#93;)
}
//-->
</script>
</span><br>

mojtabadj
یک شنبه 08 فروردین 1389, 09:41 صبح
سلام! سال نو رو به همه دوستان شادباش میگم.
خواستم بدونم چطور میشه یک داده رو که از دیتابیس فراخوانی کردیم، بگذاریمش توی یک تگِ script بطوریکه بتونه اون داده رو هم نمایش بده؟
لطفا به دستور زیر یک نگاهی بندازید: ($typer[title] رو می خوام بگذارم توی این دستور اما پی اچ پی اونو نمی خونه. وقتی این کد رو توی قالب قرار میدم، نمی تونه لینکش کنه و میزنه undefined.)


$typer1 = mysql_query(&quot;SELECT * FROM articles ORDER BY date&quot;);
$typer = mysql_fetch_assoc($typer1);

<script>
<!--
function correct(){
if (finished){
setTimeout('begin()',3000)
}
return true
}
window.onerror=correct
function begin(){
if (!document.all)
return
if (maxheight==null)
maxheight=temp.offsetHeight
whatsnew.style.height=maxheight
temp.style.display='none'
c=1
finished=true
change()
}
//-->
</script>

<style>
<!--
#whatsnew a{color:730073;text-decoration:none}
#whatsnew, #temp {font-weight:bold; font-family:Arial}
#whatsnew a:hover{color:red}
-->
</style>
<script language=\&quot;javascript1.2\&quot;>
<!--
var head=''
var top=0
var maxheight
var finished=false
var tickers=new Array()
tickers[0]='<a href=\&quot;0.htm\&quot;>$typer[title]</a>' ==> inja ro manzuram hast bachehaa

for (i=1;i<=tickers.length-1;i++){
if (tickers[i].length>=tickers[top].length)
top=i
}
if (document.all)
document.write('<span id=\&quot;whatsnew\&quot; style=\&quot;width:100%;height=10;filter:revealTrans(du ration=2,transition=19)\&quot;>'+tickers[0]+'</span>')
function change(){
whatsnew.innerHTML=''
whatsnew.filters.revealTrans.apply()
whatsnew.filters.revealTrans.play()
whatsnew.innerHTML=tickers[c]
if (c==tickers.length-1)
c=0
else
c+=1
setTimeout('change()',5000)
}
if (document.all)
document.write('<span id=ns style=\&quot;display:none;\&quot;>')
//-->
</script>
<!--Insert alternate HTML codes here
that will be seen by browsers OTHER
than IE 4.x-->
</span>
<span id=temp style=\&quot;position:absolute;left:0;top:0\&quot; style=&{head};>
<script>
<!--
if (document.all){
temp.style.width=whatsnew.style.width
document.write(tickers[top])
}
//-->
</script>
</span><br>




باید کدت رو به این صورت بنویسی



tickers[0]='<a href=\&quot;0.htm\&quot;><?=$typer[title]?></a>'