Topic: Generate html tag when hit enter question Pages that link to <a href="https://ozoneasylum.com/backlink?for=9703" title="Pages that link to Topic: Generate html tag when hit enter question" rel="nofollow" >Topic: Generate html tag when hit enter question\

 
Author Thread
Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

IP logged posted posted 11-24-2003 21:24 Edit Quote

Hi, guys. How are you?
I have jest wondering if it is possible to generate html tag when hit enter key.
I mean I have a text field in my form. That value is coming back to web page itself using ASP.
I want to formate that text field value. I have not got any idea yet.
I am trying to find through google but not found yet.
Do you know any resourse?
Cheers.

Hiroki Kozai

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

IP logged posted posted 11-27-2003 06:26 Edit Quote

well i did something like this using some of Pugzly's code. You have to highlight the text and then press a certain button on a form but it may give you what you want.

code:
function hiliteToBold(txtArea){ 
txtAreaName = txtArea.name;
txtRange = document.all[txtAreaName].createTextRange();
txtContainer = txtRange.parentElement().name;
objRange = document.selection.createRange();
hiliteTxt = objRange.text;
toBoldTxt = "<b>" + hiliteTxt + "</b>";
if(hiliteTxt != ""){
objRange.text = toBoldTxt;
}
}



so I just have my main text box called "txtArea" and from the button, call the function. I had it to where you could add paragraph tags, links, etc...

not sure if this is what you are after but it won't do it by just hitting enter.

Later,

C:\


~Binary is best~

Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

IP logged posted posted 11-29-2003 00:52 Edit Quote

Hi, thanks a lot for your reply.
Well, I wonder how hotmail format paragraph or br things when I send an email.
If I hit enter once, it takes next line, isnt' it?
Hmm....
Anybody knows how it works?

Hiroki Kozai

DmS
Paranoid (IV) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

IP logged posted posted 11-30-2003 21:54 Edit Quote

Hiroki.
Do I understand you correctly here:
You have a textfield in a form, you type into it and press enter to change the line, then you press "save" and it goes to an ASP script that does something and then you see the result. Correct?

In that case you don't do this with javascript or html.
Do it in the ASP code by checking for linefeeds (vbCr, vbCrLf, Chr(13), Chr(10) ) and convert them to <br> using 'Replace(inputString,vbCr, "<br>")' if you want to the linefeeds to show up as <br> in the HTML.

If you want to insert the HTML before you reload the page, you need to do it in JavaScript. I did this little semi-wysiwyg a bunch of years back. http://www.dmsproject.com/test/wysiwygger/DmSWysiwyg.html (GRANSKA means preview).
/Dan

/Dan

{cell 260}
-{ a vibration is a movement that doesn't know which way to go }-

[This message has been edited by DmS (edited 11-30-2003).]



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu