2011-12-20 89 views
0

* 下面是我的代碼更改RadRotator的RotatorType屬性: - 但它不工作*在鼠標懸停使用JavaScript

<telerik:RadRotator ID="TestRotator" runat="server" Width="560px" Height="140px" 
    ScrollDuration="2000" FrameDuration="20000" ItemHeight="120" ItemWidth="520" 
    WrapFrames="true" Skin="Forest" SlideShowAnimation-Type="none" RotatorType="SlideShowButtons" onClientMouseover="Rotater()"> 

JavaScript的: -

function Rotator() { 

    var RadRotator = document.getElementById('<%= TestRotator.ClientId %>'); 
    if (RadRotator.OnClientMouseOver = true){ 

     RadRotator.style.RotatorType = "SlideShowButtons"; 

    } 
    else if (RadRotator.OnClientMouseOut = false) 
    { 

     RadRotator.RotatorType="SlideShow"; 

    }   
} 

回答

0

你不」 t實際上解釋了什麼是「不工作」的意思,例如,代碼是否以意外行爲運行,或者根本不運行,但存在一些明顯的問題:

你拼寫函數名的方式並不一致:

onClientMouseover="Rotater()" 
// compared with 
function Rotator() { 

此外,我不知道情況的問題,但也許你應該有:

OnClientMouseOver="Rotator()" 

然後在函數中的兩條if語句使用=賦值運算符而不是=====比較運算符。

此外,還有一個內if語句設置RadRotator.style.RotatorType,但在其他的if語句設置RadRotator.RotatorType - 我不知道,如果.style.是正確的,但我認爲他們應該是相同的。

+0

感謝您reply.I我同時使用,但它都沒有工作RadRotator.style.RotatorType = SlideShowButtons努力「; RadRotator.RotatorType – Mahendra 2011-12-20 07:29:53

+0

我流下去,直到這條線RadRotator.style.RotatorType =‘SlideShowButtons’;以及在這一行它給出錯誤「對象不支持這個屬性和方法」。 – Mahendra 2011-12-20 07:44:10