By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,648 Members | 1,198 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,648 IT Pros & Developers. It's quick & easy.

Displaying the result in a html label.(is it possible?)

P: 283
This may be very dumb question, but still...I am displaying a value in a input tag with the value shown as readonly...

Expand|Select|Wrap|Line Numbers
  1. <input type=text size=18 maxlength=50 name="company" value=<%=companyCode %> readonly>
where <%=companyCode%> is the result that is being displayed. Can i display the result in a html label or something similar which is not editable/non-readonly(if i can say that). Just displaying the text. The result of the companyCode is retrieved in my class and in a sql query. So the value will be passed around across class/jsp page. appreciate any help.


Mar 13 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 2.5K+
P: 4,258
You can use JavaScript to make the field either ReadOnly or Disabled. Sample
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function makeReadOnly()
  3. {
  4. document.getElementById("text1").readOnly=true;
  5. }
  6. function disableField()
  7.   {
  8.   document.getElementById("text1").disabled=true
  9.   }
  10. </script>
Mar 15 '08 #2

Post your reply

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