Javascript Textbox border issue

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

    Javascript Textbox border issue

    I'm adding a Textbox with javascript, it works except for the border
    attribute, any advive
    Thanks
    John

    var formFld = document.create Element('input' )

    formFld.setAttr ibute('type', 'text')

    formFld.setAttr ibute('id', txt)

    formFld.value = document.getEle mentById(lb).in nerHTML

    formFld.name = txt

    formFld.setAttr ibute('width',' 30')

    formFld.setAttr ibute('border', '3px solid #FF0000')




  • Norm

    #2
    Re: Javascript Textbox border issue

    On May 7, 3:46 am, "john" <n...@none.comw rote:
    I'm adding a Textbox with javascript, it works except for the border
    attribute, any advive
    Thanks
    John
    >
    var formFld = document.create Element('input' )
    >
    formFld.setAttr ibute('type', 'text')
    >
    formFld.setAttr ibute('id', txt)
    >
    formFld.value = document.getEle mentById(lb).in nerHTML
    >
    formFld.name = txt
    >
    formFld.setAttr ibute('width',' 30')
    >
    formFld.setAttr ibute('border', '3px solid #FF0000')
    John,
    That last line is setting the html attribute of "border" (which I'm
    pretty sure doesn't exist on textbox) to a CSS value.
    A simple correction would be:

    formFld.setAttr ibute('style', 'border: 3px solid #FF0000;')

    Although, I'm not actually sure this would work. I would instead
    suggest using the style property as such:

    formFld.style.b order = '3px solid #FF0000'

    Reference: http://www.w3schools.com/htmldom/dom...yle.asp#border

    Hope This helps!
    Norm

    Comment

    • john

      #3
      Re: Javascript Textbox border issue

      Thanks your last method worked.
      John

      "Norm" <neonorm@gmail. comwrote in message
      news:e922745d-88e6-4121-aaba-674e7be02a25@h1 g2000prh.google groups.com...
      On May 7, 3:46 am, "john" <n...@none.comw rote:
      I'm adding a Textbox with javascript, it works except for the border
      attribute, any advive
      Thanks
      John
      >
      var formFld = document.create Element('input' )
      >
      formFld.setAttr ibute('type', 'text')
      >
      formFld.setAttr ibute('id', txt)
      >
      formFld.value = document.getEle mentById(lb).in nerHTML
      >
      formFld.name = txt
      >
      formFld.setAttr ibute('width',' 30')
      >
      formFld.setAttr ibute('border', '3px solid #FF0000')
      John,
      That last line is setting the html attribute of "border" (which I'm
      pretty sure doesn't exist on textbox) to a CSS value.
      A simple correction would be:

      formFld.setAttr ibute('style', 'border: 3px solid #FF0000;')

      Although, I'm not actually sure this would work. I would instead
      suggest using the style property as such:

      formFld.style.b order = '3px solid #FF0000'

      Reference: http://www.w3schools.com/htmldom/dom...yle.asp#border

      Hope This helps!
      Norm


      Comment

      Working...