radmenu onClicked issue

3 posts, 0 answers
  1. Ciaran
    Ciaran avatar
    21 posts
    Member since:
    Jun 2008

    Posted 18 Nov 2009 Link to this post

    Hi

    I show different panels on a page based on the different menu options

    I want to do this with JS, It works perfectly on the first click but then after that locks up the page and doesnt recognioze any more clicks

    I assume I am missing something simple but am unable to put a finger on it

    function onClicked(sender, eventArgs) 
                { 
                 
                var name = eventArgs.get_item().get_text(); 
                 
                    if (name = "Panel1"
                    { 
                        document.getElementById("Panel1").style.display='block'
                        document.getElementById("Panel2").style.display='none'
                        document.getElementById("Panel3").style.display='none'
                    } 
                    if (name = "Panel2"
                    { 
                        document.getElementById("Panel2").style.display='block'
                        document.getElementById("Panel1").style.display='none'
                        document.getElementById("Panel3").style.display='none';  
                    } 
                    if (name = "Panel3"
                    { 
                       document.getElementById("Panel1").style.display='none'
                        document.getElementById("Panel2").style.display='none'
                        document.getElementById("Panel3").style.display='block'
                    } 
                     
                } 
  2. Yana
    Admin
    Yana avatar
    4848 posts

    Posted 18 Nov 2009 Link to this post

    Hello Ciaran,

    It should be like this:

    function onClicked(sender, eventArgs) {
     
        var name = eventArgs.get_item().get_text();
     
        if (name == "Panel1") {
            document.getElementById("Panel1").style.display = 'block';
            document.getElementById("Panel2").style.display = 'none';
            document.getElementById("Panel3").style.display = 'none';
        }
        if (name == "Panel2") {
            document.getElementById("Panel2").style.display = 'block';
            document.getElementById("Panel1").style.display = 'none';
            document.getElementById("Panel3").style.display = 'none';
        }
        if (name == "Panel3") {
            document.getElementById("Panel1").style.display = 'none';
            document.getElementById("Panel2").style.display = 'none';
            document.getElementById("Panel3").style.display = 'block';
        }
     
    }


    Greetings,
    Yana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Ciaran
    Ciaran avatar
    21 posts
    Member since:
    Jun 2008

    Posted 18 Nov 2009 Link to this post

    Thats it

    Thanks Yana
Back to Top