473,809 Members | 2,701 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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')


Jun 27 '08 #1
2 1381
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

Jun 27 '08 #2
Thanks your last method worked.
John

"Norm" <ne*****@gmail. comwrote in message
news:e9******** *************** ***********@h1g 2000prh.googleg roups.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
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
9877
by: Dot net work | last post by:
Hello. Say I have a .net textbox that uses a .net regularexpressionvalidator. If the regular expression fails, is it possible to launch a small client side javascript function to do something, such as change the border color of the textbox to red? That would look quite nice: if the expression fails, the red validator text is shown, plus the textbox's border goes red. TIA,
1
5411
by: Jorge Ponte | last post by:
hi I have a Web User Control (ascx) - lets call it "My_WUC" - in a Web form. In that WUC I want have a textbox and a button. I want to click on the button and open a popup (I use javascript for that), the popup window will have also a text box and a button. when the User click on the button the value on the textbox will be send back to the textbox on My_WUC. I hope I was clear off what I want to do. I've been searching for some ideas...
8
3529
by: tshad | last post by:
I cannot seem to get the asp:textbox to use classes. Style works fine. I am trying to set the textbox to act like a label in some instance so it doesn't have a border, readonly and the background is grey. I have a class set as: ..table2Label{ border-style:none; background-color:#F6F6F6; }
4
8938
by: Greg | last post by:
I'm guessing the problem I'm having has something to do with Master Pages or DetailsView because the exact same code works fine on a page without a Master Page and DetailsView controls. The problem is, when the javascript fires on the txtDateRequiredOut TextBox in IE, I get "Error on Page" in the status bar and the error says: "Object Expected". Viewing the source of the page while running shows a link created properly for the linked...
0
2188
by: Keith | last post by:
I have a web form that contains a repeater control that is designed to ask like a check book register. Clicking on a certain transaction takes the user to a different .aspx page where it can be edited and then saved. Currently, after saving the edited transaction and returning to the check register, the repeater control table returns to the bottom. I would like the edited transaction to appear in the table instead. I know that a...
0
1897
by: Keith | last post by:
I have a web form that contains a repeater control that is designed to ask like a check book register. Clicking on a certain transaction takes the user to a different .aspx page where it can be edited and then saved. Currently, after saving the edited transaction and returning to the check register, the repeater control table returns to the bottom. I would like the edited transaction to appear in the table instead. I know that a JavaScript...
5
2585
by: settyv | last post by:
Hi, Below is the Javascript function that am trying to call from asp:Button control. <script language="javascript"> function ValidateDate(fromDate,toDate) { var fromDate=new Date();
1
2594
by: KRISHNA PRAVI | last post by:
the error is "runtime error object expected" here is the code....................................................................................... <script language="javascript" src="../Scripts/calender.js"></script> </HEAD> <body bgColor="white" MS_POSITIONING="GridLayout"> <form id="Form1" style="LEFT: 0px; POSITION: absolute; TOP: 0px" method="post" runat="server"> <!--<table width="100%" style="LEFT: 0px; POSITION:...
1
1385
by: vinya | last post by:
<html> <head> <script type="text/javascript"> var element; function test(){ abc = document.getElementById('promptbox').value; document.forms.elements.value = abc; return true; }
0
9602
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10639
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10120
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.