Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Javascript Textbox border issue

1 view
Skip to first unread message

john

unread,
May 7, 2008, 6:46:47 AM5/7/08
to
I'm adding a Textbox with javascript, it works except for the border
attribute, any advive
Thanks
John

var formFld = document.createElement('input')

formFld.setAttribute('type', 'text')

formFld.setAttribute('id', txt)

formFld.value = document.getElementById(lb).innerHTML

formFld.name = txt

formFld.setAttribute('width','30')

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


Norm

unread,
May 7, 2008, 7:39:45 PM5/7/08
to

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.setAttribute('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.border = '3px solid #FF0000'

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

Hope This helps!
Norm

john

unread,
May 8, 2008, 6:33:18 AM5/8/08
to
Thanks your last method worked.
John

"Norm" <neo...@gmail.com> wrote in message
news:e922745d-88e6-4121...@h1g2000prh.googlegroups.com...

0 new messages