2011-12-20 92 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