function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kevin NguyenKevin Nguyen 

Add an Html/Javascript tag on all Salesforce pages

Hi everyone !

We have a client with Salesforce. He would like to add our solution on it. Is it possible to add an Html tag with Javascript on all

Salesforce Page ?

Thank you for yout answer.
Ajay K DubediAjay K Dubedi
Hello Kevin Nguyen,
          Javascript can be used under script tag in visualforce page and html tags can directly be used as in html
following example shows how to do it.
<apex:page >
    <apex:form >
    <!-- Javascript>
        <script>
            function check()
            {
                document.getElementById("datetime").innerHTML= Date();
                var image = document.getElementById('myImage');
                if (image.src.match("onbulb")) 
                {
                image.src = "offbulb.jpg";
                }
                else 
                {
                image.src = "onbulb.jpg";
                }   
            }
        </script>
        <apex:pageblock >    
                <apex:pageBlockButtons >
                    <apex:commandButton onclick="check()" value="click"/>
                </apex:pageBlockButtons>
                <!--<apex:variable value="offbulb.jpg" var="x"/>-->
                <apex:image onclick="check();" value="{!$Resource.bulb}" id="myImage" width="100" height="100"/>
        <!-- Html code -->
                <p id="datetime"></p>
        </apex:pageblock>
    </apex:form>
</apex:page>

If this helps you please select it fotr best answer.
Thanks.