473,738 Members | 5,084 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to make the textbox become unchangable..

102 New Member
beginner here..hahahha.. .

how can i change the textbox become unchangable ar>??? can see but cannot change...
Jun 20 '07 #1
4 1951
gits
5,390 Recognized Expert Moderator Expert
hi ...

use:

Expand|Select|Wrap|Line Numbers
  1. var textbox = document.getElementById('your_textbox_id');
  2.  
  3. // to make it readonly
  4. textbox.setAttribute('readonly', 'true');
  5.  
  6. // to enable it
  7. textbox.removeAttribute('readonly');
kind regards ...
Jun 20 '07 #2
lyealain
102 New Member
hi ...

use:

Expand|Select|Wrap|Line Numbers
  1. var textbox = document.getElementById('your_textbox_id');
  2.  
  3. // to make it readonly
  4. textbox.setAttribute('readonly', 'true');
  5.  
  6. // to enable it
  7. textbox.removeAttribute('readonly');
kind regards ...
sorryy.. my javascript suck...!!!

i put
<head>
<script language="javas cript">
var textbox = document.getEle mentById('Part' );

textbox.setAttr ibute('readonly ', 'true');

</script></head>


my textbox name=Part and id= part

why i cant get the readonly result
Jun 20 '07 #3
gits
5,390 Recognized Expert Moderator Expert
... wrap it in a function and call it onload of your body ... this will work ;)

in case you want to have the textbox always readonly then you may do:

[HTML]<input type="text" name="whatever_ name" id="whatever_id " readonly="true"/>[/HTML]

this works too ... ! in case you want to enable it during runtime ... call a function that removes the attribute the way i showed you ...

kind regards ...

explaination: onload of the document's body all elements are already rendered by the browser engine and then you may refer to them using javascript ... the way you did javascript should throw an error from getElementById( ) ... have a look at the js-console
Jun 20 '07 #4
lyealain
102 New Member
thank you very much,.... i am new but granted a proj in javascript...ha hah...

can u help me on this quetions...

let say i have 100 textbox and i update 10 out of that ... how do i display those only updated textbox with color??...thank s

-------------------------------------------------------------------------------------------------------------
function foo(){
document.getEle mentById('test' ).className='in put2'
}

</script>
<style type=text/css>
.input {background: #ff2345; }
.input2 {background: #987654; }

</style>


<input class=input id=test type=text>
<a href=javascript :foo()>click here</a>
=------------------------------------------------------------------------------------------

they told me to do in this way.. but when i click on my update button.. it will actually go to another page to get the update function before redirect to this page ... how i show only updated textbox with color
Jun 20 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2423
by: Imaya Kumar | last post by:
Hi, i'm developing an editor in VS.NET using Rich Text Box Control. I need to make a selected text Bold. how can i do this? also i will have an Italic Button too. If i click Bold button the selected text has to become bold, and if i click italic button, the bolded text has to become Italic too with the bolded attribute. how can i do this? help me.. thanks imaya kumar
4
1898
by: Albinas | last post by:
Hi all, I am trying to customize the text box to suit the practice of my app. And I am working about the focus behavior of text field. I have met the the following problem. When I set the "tabstop" property of a textbox to "False", the textbox does receive focus when user use the mouse to click. However, if I set the "Enable" property to false,
2
12598
by: simon | last post by:
hello, new to vb.net, have a few questions about DataGrid. I have a dataGrid that is working pulling a dataset back from a stored proc and binding to the datagrid for display the datagrid's first column is a textbox(TemplateColumn), the other 3 columns are just display(BoundColumn). (1) if the value of the textbox is 0, then i'd like to change it null, so the box is empty
2
2285
by: Eniac | last post by:
*argh* ... *pull hairs* I've recently started developing from ASP to ASP.NET The switch was fairly smooth since i had done some VB.net before ... then came...FORMS! :) I find it astounding at how difficult it has become to control a form, something that was so dead easy in ASP.
15
6519
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then i added this line "" before my custom control class (i dont know what this line does). Now
2
2356
by: dougloj | last post by:
Hi. I have an ASP.NET application written in C#. To log in, a user must provide their email address and password. I already give the user a "Remember my Email Address" check box. If they check it when logging in, I store the email address in a cookie and automatically display the address when they login again. I now want to give the user a "Remember my Password" checkbox. If they check this new checkbox, I'm planning on encrypting...
18
2667
by: active | last post by:
Console.WriteLine(String.Equals(s, s.Clone.ToString)) s is type string. This returns True. If Clone really made a new copy I'd expect False.
2
2787
by: JLC | last post by:
Hi, I am creating a page in asp.net that has a checkbox and a textbox. When the checkbox is checked I want the textbox to become active and show text. If the checkbox is unchecked, I would like the text box to become disabled and show no text. Is this possible to do via javascript? I would like to handle it all client side. Thanks, JLC
0
1593
by: Ronald S. Cook | last post by:
Stupid question for the day but weirdly I don't have this yet. How can I format a textbox such that if the user enters a number like 4 it will become (on validated) 4.00. If they enter 5.1 it will become 5.10. If they enter 1.239 it will become 1.24. Thanks for the help.
0
8968
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8787
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
9473
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
9334
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...
1
9259
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8208
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
6053
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
4824
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.