Loading...

Applying Color Coding to a SharePoint List.

Applying Color Coding to a SharePoint List.

  • This topic is empty.
Viewing 1 reply thread
  • Author
    Posts
    • #4621
      Anonymous
      Anonymous
      Participant

      Hi!

      Can anyone share their knowledge with me, regarding an error message that I received from a JavaScript that was developed in Notepad.  The error message that I receive and the JavaScript that I developed are as follows:

      Error Message

      Script: C:\Users\robertsd\Desktop\Conditional Severity.js

      Line: 1

      Char: 1

      Error:  Syntax Error

      Code: 800A03EA

      Source:  Microsoft JScript compliation error

      Developed JavaScript:

      <script type=”text/JavaScript”>function DisplaySeverity(severity){        var imgSrc = ‘ ‘;

              if (severity == ‘(1) OVERDUE’)            {                         imgSrc = ‘teamspace.merck.com/…/Overdue.png‘;             }             else if (severity == ‘(2) Alert’)             {                                      imgSrc = ‘teamspace.merck.com/…/Alert.png‘;             }             else if (severity == ‘(3) ON TIME’)             {                       imgSrc = ‘teamspace.merck.com/…/On%20Time.png‘;             }             else if (severity == ‘(4) Completed On Time’)             {          imgSrc = ‘teamspace.merck.com/…/Completed%20On%20Time.png&rsquo;;      }             return  ‘<img alt=”’ + severity + ‘” src=’” + imgSrc + ‘”>’;             }</script>

       Thanks in advance for your response.

       

    • #7422
      Anonymous
      Anonymous
      Participant

      Hi ,

       

      At the first sight for the script, I noticed that some single quotes and the double quotation marks are wrong in the script, I am not sure whether it is the editor issue. I have modify it, you could take a try.

       

      <script type="text/JavaScript">

      function DisplaySeverity(severity)

      {

             var imgSrc = ' ';

             if (severity == '(1) OVERDUE')

                 {

                               imgSrc = 'teamspace.merck.com/…/Overdue.png';

                   }

                   else if (severity == '(2) Alert')

                   {            

                             imgSrc = 'teamspace.merck.com/…/Alert.png';

                   }

                   else if (severity == '(3) ON TIME')

                   {

                             imgSrc = 'teamspace.merck.com/…/On%20Time.png';

                   }

                   else if (severity == '(4) Completed On Time')

                   {

               imgSrc = 'teamspace.merck.com/…/Completed%20On%20Time.png&rsquo';

                   }

                   return '<img alt="' + severity + '" src="' + imgSrc + '">';

                   }

      </script>

       

Viewing 1 reply thread

You must be logged in to reply to this topic. Click here to Login