Conditional Formatting

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • T3letech

    #1

    Conditional Formatting

    I'm trying to find out if it is possible to use javascript to make a
    line of text appear on an HTML page, depending on database values. I
    assume it is, but cannot get it to work. The database field is
    capable of having one of 3 values, "R", "S", or "N". When the
    database value is "R" or "S", I want the line of text to appear on the
    page. If the database value is "N", I don't want any text to appear
    (blank line is fine...).

    I am using several webpages in conjunction with a common.js file and
    use Dreamweaver for design.

    Any help will be appreciated.

    Thanks!
  • Stewart Gordon

    #2
    Re: Conditional Formatting

    T3letech wrote:
    [color=blue]
    > I'm trying to find out if it is possible to use javascript to make a
    > line of text appear on an HTML page, depending on database values. I
    > assume it is, but cannot get it to work. The database field is
    > capable of having one of 3 values, "R", "S", or "N". When the
    > database value is "R" or "S", I want the line of text to appear on the
    > page. If the database value is "N", I don't want any text to appear
    > (blank line is fine...).[/color]
    <snip>

    Using a JS to access a database, eh?

    Use an if statement. If you're having difficulties, post some code
    you're trying to use.

    Stewart.

    Comment

    • Alan Horsman

      #3
      Re: Conditional Formatting

      Thanks for the reply Stewart.
      If you can't tell...I'm very new to JavaScript. I believe the code is
      accessing the database. I am not sure though...

      I should have posted my code originally.

      Here is the code in my "common.js" file:

      document.write( '<input name= IS_ATTR_CM_MINO R_LETTER_STATUS _CODE_1"
      type="hidden">' );

      (This fuction is not working...)
      //New function for Minor Child rollout:
      function MinorChild(sMin orChild) {
      if (IS_ATTR_CM_MIN OR_LETTER_STATU S_CODE_1 == 'R' ||
      IS_ATTR_CM_MINO R_LETTER_STATUS _CODE_1 == 'S'){
      sMinorChild = 'Minor Child Letter Request'
      //else
      //sMinorChild = ''
      }
      }

      Here is the code on my HTML page:

      (in the <script> section)
      MINOR_CHILD_DAT A.innerText = FormatStringDat a(sMinorChild.v alue, 0,
      'N/A');

      (in the body of the page)
      <p><span name = "MINOR_CHILD_DA TA">Minor Child?</span></p>



      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      Working...