www.webdeveloper.com
Results 1 to 2 of 2

Thread: Color change of item

  1. #1
    Join Date
    Nov 2013
    Posts
    1

    Color change of item

    this script goes through a list of items and looks for ones with a price error
    I would like to be able to change the color of the item that has a price error to red

    function findMissingPrices()
    {
    var pricesGood = true;
    var itemVal = "";
    var itemVals = [];
    totCount = 0;

    for(var i=1;i<200; i++)
    {
    var prtNum = "Tank_Parts_Number_OUT" + (i + "");
    var itemNum = document.getElementsByName(prtNum)[0].value;
    if (itemNum != "" && !(itemNum == "WARNING" || itemNum == "ACTUAL_HEIGHT" || itemNum == "ACTUAL_DIA" || itemNum == "ACTUAL_CAPACITY" || itemNum == "ACTUAL_CONTENT" || itemNum.substr(0, 3) == "CPQ"))
    {
    itemVals.push(itemNum);
    totCount = totCount + 1;
    }
    }
    itemVal = "'" + itemVals.join("', '") + "'";
    var q = new Query("itemCountData");
    q.invoke("select count(*) from co_item_master where smartpart_num in (" + itemVal + ")" , 1, "parseCountResult('itemCountData')");

    }

    function parseCountResult(id)
    {
    document.ui.MISSING_PRICE.value = "N";
    var q = queryManager.getQuery(id);
    if ( q.results[0] * 1.0 < totCount )
    {
    document.ui.MISSING_PRICE.value = "Y";
    }
    else
    {
    findFoundationMissingPrices();
    }
    }

  2. #2
    Join Date
    Nov 2013
    Location
    London, United Kingdom
    Posts
    15
    Generally, the color of the element can be changed using the style property. For example, if the color should be changed to red:

    Code:
       element.style.color = 'red';
    where element is just a reference to the HTML node in Web page script.

    But the context of your code is quite unclear - it looks like a Web page script but then you run SQL queries Well, as soon as it is a single-user application it is fine but you may be really get into troubles with this approach.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles