PDA

View Full Version : [DHTML] (Unobtrusive)Insert in HTML textareas.



shachi
12-20-2006, 06:16 PM
1) CODE TITLE: Insert in HTML textareas

2) AUTHOR NAME/NOTES: Has some problems with the <tab> key

3) DESCRIPTION: It enables one to use the insert key(lacking in plain textareas)

4) DEMO: http://captninsano.tripod.com/insertextarea.html

4.1) UPDATED DEMO URL: http://shachi.eparliament.org/insertextarea.html

5) URL TO CODE:

djr33
12-21-2006, 02:33 AM
Cool coding, I suppose.
But I hate the insert key :D

ddadmin
12-21-2006, 03:39 AM
You've got to ditch Lycos as your host :) The popups are killing me.

shachi
12-21-2006, 08:30 AM
ddadmin: Yeah, I hate that too, that's why I use adblock plus.;) What shall I use then?(Instead of lycos)

drj33: Thanks. :)

BLiZZaRD
12-21-2006, 08:48 AM
What does the insert key do anyway? 10 or so years I have had a keyboard near me and I think I have pressed it once. That once was an accident as well. ROTF.

If your not using php, you can try geocities freehosting.

If you want ad free for cheap you can try site5.com or search ebay. :D

shachi
12-21-2006, 08:52 AM
BLiZZaRD: The insert key simply replaces the character which lies after the cursor position.

BLiZZaRD
12-21-2006, 09:04 AM
OHHH the over-write, instead of adding-to.. gotcha!

ddadmin
12-21-2006, 10:24 AM
Regarding free hosting, I would consider free blog hosts, which is where the quality ones are right now it seems. You can try searching Google, though the most well known is http://www.blogger.com/ I think Wordpress also offers free blog hosting.

shachi
12-21-2006, 10:26 AM
BLiZZaRD: Yep, you can see an online demo here: http://captninsano.tripod.com/insertextarea.html

ddadmin: Thanks. :) By the way does this work on all browsers?(not tested yet)

djr33
12-21-2006, 10:57 AM
Mozilla, yes. I can test safari later if needed. (and IE, but surely someone has done that)

My question-- does this relate to the actual setting of the insert key, or is it based on pressing it while in the box. If it's based on pressing while in the box, then that could be the opposite of the actual setting, like in Word, so you'd go back and forth and it would be split. Just a random though. Likely a rare issue to be a problem.

shachi
12-21-2006, 11:20 AM
is it based on pressing it while in the box

Box?? I didn't get what you meant(Sorry bad english).

shachi
12-21-2006, 02:44 PM
ddadmin: The Demo URL has been updated, no popups or ads now.

djr33
12-22-2006, 03:35 AM
Is the insert function based on a system setting of the insert key being 'set' or is it based on the act of pushing the insert key while your cursor is in the box?

shachi
12-22-2006, 07:29 AM
It is based on the act of pushing the insert key while your cursor is in the box because the box has the onkeyup handler to capture the event.

djr33
12-22-2006, 07:33 AM
Ok.
Then note that if you had insert set (in the system, like in MS Word), and pressed it while in the box, it would be OFF in WORD, and ON in your page.

shachi
12-22-2006, 08:14 AM
I don't think so, because I just tested it with abiword and it doesn't behave like that(on remains on and off remains off). It maybe also because of the operating system(currently linux), drj33 can you test it if you've got windows? Thanks for the suggestion though, if it is true then I think I know what I should do.

djr33
12-22-2006, 09:09 AM
It works half the time.

Here's how it won't work:
1. Open word, start typing.
2. Press insert key.
3. Go to your demo page.
4. Click into the textbox.
5. Hit insert.
6. Go back to word.
7. Insert no longer is set.


so... if you set it in word, then set again on your page, won't work.
If you set on your page, then go to word, it will work.
If you set it in word to NOT be inserting, it will also be the same in your textbox*.
*assuming you haven't previously set it. Example:
1. Open demo page.
2. Click in textbox.
3. Hit insert.
4. Click to word
5. Hit insert key to turn off.
6. Insert is off in word.
7. Click back to demo page-- note that insert key is ON.


The reason is that the insert key is a system function. The textbox-only-based function you have can get off from that if insert is pressed outside of the textbox.
This is because:
--Every time you press INSERT, it changes the system setting.
--Only when you are in the textbox does it change your setting.


In all practical ways, this isn't very important, but it is worth thinking about.

shachi
12-22-2006, 11:07 AM
drj33: Strange, it doesn't happen in linux(using abiword and openoffice), must be some problems with Windows or MS Word.

djr33
12-23-2006, 03:22 AM
It's not a problem, and it makes perfect sense to me. What browser? I'm using FF.

Random note-- I was just going to test on Mac OSX (safari, FF, IE5), but then I noticed there is NO insert key. There is, interestingly enough, a "help" key. :p Never had the occasion to try that... but.... yeah.

shachi
12-23-2006, 07:46 AM
drj33: I am using FF too(don't have opera and ie4lin works horrible, and no safari for linux. Therefore no other option), thanks for testing though, I don't think the help key does the work of the insert key does it?;):p

djr33
12-23-2006, 09:48 AM
ha, i'm sure it doesn't... no clue what it does do, though....

shachi
12-25-2006, 08:20 AM
I think you should try it.:p

djr33
12-26-2006, 08:44 AM
Hmm... k.
It appears to just activate the little question mark cursor so you can click on anything that has a help balloon associated with it. But... doesn't seem to do much :p
Might be left over from an older MacOS when it did help, like some keys are left over from the DOS days of PCs.

merz
12-26-2006, 09:20 AM
I'm trying to make a wallpaper background on my website using my picture. Can anyone help me the coding?? Please tnx u so much.....

djr33
12-26-2006, 10:26 AM
Totally the wrong place for this.
This area is for SUBMITTING code, and this particular thread is about an existing code. Please don't change the topic.
This question belongs in the "HTML" area.
Just to keep things simple, here's your answer anyway:
<body background="path/image.jpg">
Any further questions do not belong here. Start a new thread in the correct area.

shachi
01-05-2007, 09:47 AM
drj33: just found out that the setPosition doesn't work in IE and the cursor jumps to the end after replacing a letter. I hope to fix this soon(hopefully)

djr33
01-06-2007, 06:22 AM
which IE?

shachi
01-06-2007, 03:08 PM
IE 6 windows

jscheuer1
01-07-2007, 09:10 AM
The insert key works here (Win XP Media Edition) in textareas in IE 7 & 6 and Opera 9.01 without any help. But, not in FF. However, in both IE's there is no visual cue that you have the insert cursor whereas in Opera, it gets thicker, as it traditionally does in other applications.

shachi
01-08-2007, 09:08 AM
jscheuer1: It does?? Oh, maybe I didn't check them(I didn't) well anyways, my script only works in firefox and thanfully insert key doesn't work in firefox so in browsers that don't need my script, they have insert as their default and for those which need 'em(FF) can use my script so there's no need to fix the bug popping on IE6. Thanks for letting us know about it jschuer1.:)