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!

      n

      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:

      n

      Error Message

      n

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

      n

      Line: 1

      n

      Char: 1

      n

      Error:  Syntax Error

      n

      Code: 800A03EA

      n

      Source:  Microsoft JScript compliation error

      n

      Developed JavaScript:

      n

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

      n

              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>

      n

       Thanks in advance for your response.

      n

      n

       

    • #7422
      Anonymous
      Anonymous
      Participant

      Hi ,

      n

       

      n

      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.

      n

       

      n

      <script type="text/JavaScript">

      n

      function DisplaySeverity(severity)

      n

      {

      n

             var imgSrc = ' ';

      n

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

      n

                 {

      n

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

      n

                   }

      n

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

      n

                   {            

      n

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

      n

                   }

      n

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

      n

                   {

      n

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

      n

                   }

      n

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

      n

                   {

      n

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

      n

                   }

      n

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

      n

                   }

      n

      </script>

      n

       

      n

Viewing 1 reply thread

You must be logged in to reply to this topic.