gpt4 book ai didi

php - JavaScript OnMouseOver 解析错误 : syntax error, 意外 T_STRING

转载 作者:行者123 更新时间:2023-11-30 13:32:46 26 4
gpt4 key购买 nike

当我在 <a and > 中编写此代码时

<a href="'.get_permalink($niphell[post_id]).' " onmouseover="mns('#msnbtn-'.($j+1).'','#msn-'.($j+1).'','.mnsli','.mnsbtbg');">

我遇到了这个错误

Parse error: syntax error, unexpected T_STRING in /home/azerinfo/public_html/wp-content/themes/anntheme/scroller.php on line 125

jQuery 代码:

<script type="text/javascript">
function mns(e,d,c,s){
jQuery(s).removeClass('aktif');
jQuery(e).addClass('aktif');
jQuery(c).css({display: 'none'});
jQuery(d).css({display: 'block'});
}
mns('#msnbtn-1','#msn-1','.mnsli','.mnsbtbg');
</script>

更新:

<div class="mns">
<div class="crv">

<style>

.imns{
background-color: #E8E5E5;
display: block;
float: left;
height: 376px;
margin-top: 5px;
padding:10px 0px 10px 10px;
position: relative;
width: 600px;
}
.imns .imns_content{
background-color: #E8E5E5;
display: block;
float: left;
height: 376px;
position: relative;
width:400px;
}
.imns .imns_content li{
background-color: #E8E5E5;
display: none;
float: left;
height: 376px;
position: relative;
width:400px;
}
.imns .imns_content li a.hbr{
background-color: #E8E5E5;
display: block;
float: left;
height: 376px;
position: relative;
width:400px;
}
.imns .imns_link{
background-color: #E8E5E5;
display: block;
float: left;
height: 376px;
position: relative;
width: 200px;
}
.imns .imns_link li{
background-color: #E8E5E5;
display: block;
float: left;
height: 50px;
position: relative;
width: 200px;
padding-bottom:4px;
}
.imns .imns_link li a div.mnsbtbg{
background:url(http://azerinform.com/wp-content/themes/anntheme/images/mns_numa.jpg) left top;
display: block;
height: 50px;
position: relative;
width: 196px;
color:#004072;
z-index:999999;
cursor:pointer;
overflow:hidden;
}
.imns .imns_link li a div.aktif{
background:url(http://azerinform.com/wp-content/themes/anntheme/images/manset_a.gif) no-repeat left top;
display: block;
height: 50px;
position: absolute;
width:215px;
color:#FFFFFF;
margin-right:6px;
z-index:999999;
right:0;
cursor:pointer;
}
.imns .imns_link li a div.aktif div.mnsbaslik{
line-height:16px;
margin-left:15px;
}
.imns .imns_link li a div.mnsbaslik{
margin:-3px 0 0 3px;
width:157px;
line-height:18px;
}
.imns .imns_link li a div.mnsnumara{
color:#d2d0d1;
}
.tummansetler {
background: url(http://azerinform.com/wp-content/themes/anntheme/images/tum_mans.png) repeat scroll 0 0 transparent;
display: block;
float: left;
height: 27px;
width: 400px;
margin-top:350px;
position:absolute;
z-index:999;
}
.mnsustkategori {
color: #FFFFFF;
float: left;
font-weight: bold;
height: 20px;
padding-left: 5px;
padding-top: 12px;
width: 120px;
}
</style>





<?php
$resim = mysql_query("SELECT * FROM ".$table_prefix."postmeta LEFT OUTER JOIN ".$table_prefix."posts ON ".$table_prefix."postmeta.post_id = ".$table_prefix."posts.id Where ".$table_prefix."postmeta.meta_key='manset' ORDER By ".$table_prefix."postmeta.post_id DESC Limit 7");
for ($j=0; $niphell=mysql_fetch_array($resim); $j++){
$ust .= '<li><a href="'.get_permalink($niphell[post_id]).'" onmouseover="mns('#msnbtn-'.($j+1).'','#msn-'.($j+1).'','.mnsli','.mnsbtbg');">




<div id="msnbtn-'.($j+1).'" onclick="window.location.href='.get_permalink($niphell[post_id]).'" class="mnsbtbg">
<table height="50" border="0"><tr>
<td valign="middle"><div class="mnsbaslik font2">'.$niphell[post_title].'</div></td>
<td valign="middle"><div class="mnsnumara font3">'.($j+1).'</div></td>
</tr></table>
</div> </a></li>
';


$alt .='<li id="msn-'.($j+1).'" class="mnsli">
<img src="'.$niphell[meta_value].'" width="420" height="370" alt="" />

</li>
';
}
echo '<!-- Wordpress Manset Eklentisi NipHeLL Tarafindan Kodlanmistir bozlak216@gmail.com -->';
?>


<div class="imns">
<div class="imns_content">

<ul>
<?php echo $alt;?>

</ul>
</div>


<div class="imns_link">


<ul>

<?php echo $ust;?>


</ul>
</div>





</div>

<script type="text/javascript">
function mns(e,d,c,s){
jQuery(s).removeClass('aktif');
jQuery(e).addClass('aktif');
jQuery(c).css({display: 'none'});
jQuery(d).css({display: 'block'});
}
mns('#msnbtn-1','#msn-1','.mnsli','.mnsbtbg');
</script>


</div>

</div>

最佳答案

您的问题是对 JS 使用单引号以及对 PHP 使用单引号。 PHP 无法判断某些单引号不是为它设计的。

举个例子,这里:

    $ust .= '<li><a href="'.get_permalink($niphell[post_id]).'" onmouseover="mns('#msnbtn-'.($j+1).'','#msn-'.($j+1).'','.mnsli','.mnsbtbg');">
P P P J

您打算由 JS 解释第四个单引号,但 PHP 正在捕获它。

您可能应该更改为在 PHP 中使用双引号,并像这样在 HTML 中转义您想要的双引号:

    $ust .= "<li><a href=\"".get_permalink($niphell[post_id])."\" onmouseover=\"mns('#msnbtn-'.($j+1).'','#msn-'.($j+1).'','.mnsli','.mnsbtbg');\">

等等

关于php - JavaScript OnMouseOver 解析错误 : syntax error, 意外 T_STRING,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6131639/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com