 |
| HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

March 16th, 2005, 01:07 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
How would you determine the "ENTER' key?
Hi All,
I have a text field in my SQL table.
How would you determine the "ENTER" keys in this text field?
When I display it in a table cell, it is basically a free text format.
But in a <TEXTAREA> tag, it lines up properly.
For example:
Text Field: This is the first line.
This is the second line.
If I use <td> tag, it displays as
"This is the first line. This is the second line."
I I use <textarea> tag,
"This is the first line.
This is the second line."
So, if I can determine the "ENTER" keys, I can manually create new lines.
Thanks,
MCinar
Love all the creatures because of the creator.
__________________
MCinar
Love all the creatures because of the creator.
|
|

March 17th, 2005, 03:57 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
You need to replace the new line character
with the HTMl break
.
--
Joe ( Microsoft MVP - XML)
|
|

March 17th, 2005, 05:38 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
|
|
or you could just use <pre> tags, they preserve line breaks
|
|

March 17th, 2005, 09:27 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
How are you setting the value? If you use innerText instead of innerHTML it should keep the breaks.
--
Joe ( Microsoft MVP - XML)
|
|

March 17th, 2005, 11:19 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
DIM strValue
strValue = rs("text_field")
Thanks.
MCinar
Love all the creatures because of the creator.
|
|

March 22nd, 2005, 11:23 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Hi Joe,
I used the following code, but it didn't help me to replace the "Break Line Code" with "<BR>".
Here is my code;
strBillingInstruction = rs("Billing_Instruction_TX")
strBillingInstruction = server.URLEncode(strBillingInstruction)
strBillingInstruction = REPLACE(strBillingInstruction, "%0D%0A","<BR />")
Response.Write strBillingInstruction
After using "REPLACE", I also like to reverse it back to normal text.
Thanks for your help,
MCinar
Love all the creatures because of the creator.
|
|

March 22nd, 2005, 12:01 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
You don't need to URLEncode the data. You either need:
Code:
strBillingInstruction = REPLACE(strBillingInstruction, vbCrLf, "<BR />")
or
Code:
strBillingInstruction = REPLACE(strBillingInstruction, vbLf, "<BR />")
depending if the original text has carriage return and line feed or just line feed. I suspect it will be the latter.
--
Joe ( Microsoft MVP - XML)
|
|

March 22nd, 2005, 12:04 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Thank you, Joe.
MCinar
Love all the creatures because of the creator.
|
|

March 22nd, 2005, 10:31 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Hi Joe,
I have one more question and I am not sure if it is possible.
I tried to implement the following in Classic ASP and it did not work properly. I hope there is a better solution in .NET.
" I have a "Combo Box" of companies.
One of the companies is "MICROSOFT".
When I press the letter "M", it jumps the first company that starts with the letter "M". What I am trying to achieve is to get to
"MICROSOFT" by pressing the letters "M, I, C and so on" on the Combo Box.
Right now, if you press "M" and then "I", it jumps to the first company that starts with the letter "I", which is the default setup."
Thanks,
MCinar
Love all the creatures because of the creator.
|
|

March 23rd, 2005, 04:43 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
I have seen some boxes that do this, they use client side script to simulate the behaviour. Try searching for "dhtml combobox" or "javascript combobox". Or if you're feeling adventurous write your own. The basic technique is to trap the keypress and if it the first character or is pressed within a short time of the preceeding caharacter then search for the relevant entry.
--
Joe ( Microsoft MVP - XML)
|
|
 |