More in this section

Forums / General Discussions / Find a control with javascript

Find a control with javascript

3 posts, 0 answered
  1. Ron
    Ron avatar
    12 posts
    Registered:
    08 Jun 2010
    21 Nov 2011
    Link to this post
    I want to change the value of an <a> that I have embedded in a content block with javascript.

    Here is the tag
    <a href="#" name="bgController" onclick="defaultImage()">Turn background off</a>

    My javascript does not find the control - is this because the control is in a content block?

    Thanks

    Ron


    Here is the javascript

    function defaultImage() {
        var theLink = document.getElementById("bgController");
     
        if (theLink.value == 'Turn background off') {
            document.body.className = "defaultBG";
            theLink.value = 'Turn background on';
        }
        else {
            document.body.className = "schoolBG";
            theLink.value = 'Turn background off';
        }
    }
  2. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    23 Nov 2011
    Link to this post
    Hi Ron,

    I answered you question in the other forum thread.

    Greetings,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Ron
    Ron avatar
    12 posts
    Registered:
    08 Jun 2010
    28 Nov 2011
    Link to this post
    Thanks!!

    I couldn't find my original post - sorry for the double post

    Thanks again for all the help

    Ron

3 posts, 0 answered