2013-05-02 91 views
0

嗨,我正在一個項目上工作,而且這個項目中的所有內容都是在yii框架中編寫的。我已經很遠了,但是在某個時候我陷入了僵局,我在Google上搜索時找不到任何有關這方面的信息。這就是爲什麼我要求你的幫助!懸停效果PHP不工作

在下面的代碼,我需要申請一個懸停效果。代碼是用php和yii框架編寫的。

 $_SESSION['Active'] = $_GET["Share"]; 
    if (isset($_GET["Share"])){ 
    $sharepanel = array('src' => $sImageURL.'share1.png', 
    'alt' => $clang->gT("Share panel"), 
    'title' => $clang->gT("Share panel"), 
    'height' => 35, 
    'width' => 35, 
    'style' => 'margin-left:5px'); 
+1

你不能適用於'hover'效果'php' – itachi 2013-05-02 07:46:28

+0

那麼我怎樣才能實現這一目標呢? – 2013-05-02 07:46:57

+1

'javascript'或'css' – itachi 2013-05-02 07:49:35

回答

0

我會爲此使用CSS。像下面這樣的東西。

img:hover { 
    border: 1px solid red; 
} 

不太清楚如何支持:hover對於<img>標籤雖然。

+0

而之前寫'IMG {邊界:1px的固體透明}' – nk9 2013-05-02 08:46:00

+0

僞類只在是問題IE6;) – nk9 2013-05-02 08:49:37

0

根據

我需要定製一個已經寫好的模板

你可以寫低劣的代碼,就像在你自己的風險

<div class="something" 
    onmouseover="this.setAttribute('style','border: 1px solid yellow;');" 
    onmouseout="this.setAttribute('style','border: 1px solid transparent;');"> 
text 
</div> 

https://stackoverflow.com/a/11728590/1346222

使用。隨着殘疾人JS這是不行的

$sharepanel = array(
    'src' => $sImageURL.'share1.png', 
    'alt' => $clang->gT("Share panel"), 
    'title' => $clang->gT("Share panel"), 
    'height' => 35, 
    'width' => 35, 
    'style' => 'margin-left:5px; border: 1px solid transparent;', 
    'onmouseover' => "this.setAttribute('style','border: 1px solid yellow;');", 
    'onmouseout' => "this.setAttribute('style','border: 1px solid transparent;');", 
);