Announcement

Collapse
No announcement yet.

what is this code?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    what is this code?

    can anyone tell me what the code below does, and is it standard actinic

    Code:
    <script>
    function change(tag, file) {
    document.images[tag].src= file;}
    </script>

    #2
    I don't know what Actinic are using it for, but its a function to set the URL of an image in the current page. the 'tag' is just an index number

    Comment


      #3
      what is the general consensus re adding extra js code for functionality?

      is it good practice to add it to actinicextras.js? is it more secure?

      Comment


        #4
        Dunno about security.

        Every additional file is more to a download. Its thought better to have one or two larger files. However, I've kept my js out of the Actinic .js files in case I upgrade.

        Comment


          #5
          Originally posted by pinbrook View Post
          what is the general consensus re adding extra js code for functionality?

          is it good practice to add it to actinicextras.js? is it more secure?
          Using your own external file gives you more control especially if actinic change the code on an update. It really depends on what you are doing, if the js only affects one or two pages then it might be better to put it in the pages themselves, if it affects lots of pages then an external file (same principal as css). Lots of small files means more overhead in downloading so I would have just one file with your own code in it.

          As for security it takes a few seconds to examine an html page to find the js files and not much more time to download them, whether it's an actinic file or one of your own.

          Malcolm

          SellerDeck Accredited Partner,
          SellerDeck 2016 Extensions, and
          Custom Packages

          Comment


            #6
            Originally posted by pinbrook View Post
            can anyone tell me what the code below does, and is it standard actinic

            Code:
            <script>
            function change(tag, file) {
            document.images[tag].src= file;}
            </script>
            Jo,

            It simply changes the src property of an HTML image element to the value of the file property sent to it.
            tag = the image element
            file = the src value you want it changed to


            We would recommend putting any common, regularly used javascript functions into a separate JS file and reference it in the head in the same way as the actiniccore.js files. This solves problems when upgrading etc
            Fergus Weir - teclan ltd
            Ecommerce Digital Marketing

            SellerDeck Responsive Web Design

            SellerDeck Hosting
            SellerDeck Digital Marketing

            Comment

            Working...
            X