473,407 Members | 2,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Putting a cusor in normal text

Hi all you JS experts,
Is there any way to put a blinking ibeam cursor in middle of td text -
the same way it would blink if I clicked in the middle of the text in a
text input? To further explain, I can highlight any text on an HTML
page by dragging, but if I just click I get no ibeam cursor (obviously
because I am not supposed to be able to edit). Is there anyway to get
one to sit there and blink where-ever I click on the page.
Thanks for your help
Pachydermitis

Jul 26 '05 #1
6 3286
VK
de******@hotmail.com wrote:
Hi all you JS experts,
Is there any way to put a blinking ibeam cursor in middle of td text -
the same way it would blink if I clicked in the middle of the text in a
text input? To further explain, I can highlight any text on an HTML
page by dragging, but if I just click I get no ibeam cursor (obviously
because I am not supposed to be able to edit). Is there anyway to get
one to sit there and blink where-ever I click on the page.
Thanks for your help
Pachydermitis


You can set it very easy for IE by using contenteditable attribute
(note that you cannot set table cell itself to contenteditable, so you
need a div wrapper).

<html>
<head>
<title>contentEditable</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<style type="text/css">
body { background-color: #FFFFFF}
td div { font: 10pt Verdana, Helvetica, sans-serif; height: auto;
width: 100%}
</style>
</head>
<body>
<table width="75%" cellpadding="10" cellspacing="0" border="1">
<tbody>
<tr>
<td width="33%"><div contenteditable="true">empty</div></td>
<td width="34%"><div contenteditable="true">empty</div></td>
<td width="33%"><div contenteditable="true">empty</div></td>
</tr>
<tr>
<td><div contenteditable="true">empty</div></td>
<td><div contenteditable="true">Lorem ipsum dolor sit amet,
consectetuer
adipiscing elit. Phasellus in sem lacinia nunc rutrum tempor. Vivamus
facilisis.
Vivamus lectus eros, aliquet id, tincidunt in, tempus quis, erat. Etiam
scelerisque
sem et massa. Cum sociis natoque penatibus et magnis dis parturient
montes, nascetur
ridiculus mus. Ut at arcu. Praesent et turpis ac urna ornare hendrerit.
Mauris
vitae pede a libero scelerisque egestas. Nunc sollicitudin, orci et
commodo ultrices,
nisl libero vulputate urna, in posuere ligula arcu ut libero. In
ullamcorper neque
ut mi.</div></td>
<td><div contenteditable="true">empty</div></td>
</tr>
<tr>
<td><div contenteditable="true">empty</div></td>
<td><div contenteditable="true">empty</div></td>
<td><div contenteditable="true">empty</div></td>
</tr>
</tbody>
</table>
</body>
</html>

I guess you can emulate this on Firefox using document.designMode
property.

Opera and Safary (at least) do not have the necessary TextRange
methods. So you can get the selection using document.getSelection(),
but you cannot reliably attach it to the particular place in the
document (find the corresponding DOM block).

Jul 26 '05 #2
- Hope this isn't a repeat post the first died -
VK you're awesome - this works even better than I had hoped - with much
less work on my part.
Lorem ipsum threw me for a minute; I knew it looked familiar, thought
it was Latin, and looked it up . . duh do I feel like an uneducated
clod. :)
Thanks for the help
Pachydermitis

Jul 26 '05 #3
VK
Pachydermitis wrote:
- Hope this isn't a repeat post the first died -
VK you're awesome - this works even better than I had hoped - with much
less work on my part.
Lorem ipsum threw me for a minute; I knew it looked familiar, thought
it was Latin, and looked it up . . duh do I feel like an uneducated
clod. :)
Thanks for the help
Pachydermitis


"Lorem ipsum" is the standard bogus text to use as placeholder. It's a
"pseudo-Latin" - composed of Latin words but means nothing. I hope you
did try to translate it! :-)

Jul 26 '05 #4
VK wrote:
de******@hotmail.com wrote:
Hi all you JS experts,
Is there any way to put a blinking ibeam cursor in middle of td text -


You can set it very easy for IE by using contenteditable attribute


Do you happen to know if something like that is possible for
Mozilla/Firefox?
Jul 28 '05 #5
Robert wrote:
VK wrote:
de******@hotmail.com wrote:
Hi all you JS experts,
Is there any way to put a blinking ibeam cursor in middle of td text -

You can set it very easy for IE by using contenteditable attribute

Do you happen to know if something like that is possible for
Mozilla/Firefox?


<URL:http://www.mozilla.org/editor/ie2midas.html>

--
Rob
Jul 28 '05 #6
Yes - the fact that it is the standard bogus placeholder text for
typesetting came painfully back to memory - after I tried to translate
it. :)

Aug 3 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Markus Franz | last post by:
Hi. I used urllib2 to load a html-document through http. But my problem is: The loaded contents are returned as binary data, that means that every character is displayed like lÀÃt, for...
7
by: Lachlan Hunt | last post by:
Hi, I have recently downloaded and experemented with IBM HPR 3.0, and Opera 8 with text-to-speech, and have come to realise some fairly annoying issues regarding punctuation marks. I've found,...
11
by: Yeah | last post by:
I have a multiple choice quiz where I would like to use CSS to change the color of the answers upon clicking them. I would like to present the right and wrong answers up front, rather than direct...
0
by: TadPole | last post by:
I am using FOP to create PDF documents. I have the problem where I need to create line of text on a document in a certain line (absolute position), then the rest of the text needs to follow...
15
by: phillip.s.powell | last post by:
<style> div div table tr td a.navbar, div div table tr td font {display: none;} </style> <div class="navigationbar" style="background-color:Black; position: absolute; left:50%; top:127px;...
0
by: mephraim | last post by:
I have a page at (view in IE): http://rmc2.dev.leepfrog.com/ie_fix_me/index.html that has an image floated right outside of a main content div that looks like: <img src="blah" style="float:...
1
by: maflatoun | last post by:
Hi, I'm using the asp:TreeView component of asp.net 2.0 and my tree is structure is Root -- Parent 1 --------- Leaf 1 --------- Leaf 2
1
by: coldbuttmoneky | last post by:
Now i know that clearing a text field in normal macromedia flash is a simple: textfield.text=""; but when this is place into a button on selteco flash, it doesnt seem to clear anything. The name...
6
by: acorna | last post by:
Hi All This may seem like a stupid question but I can't get my text to left align. It used to but it's now decided to centre and I can't see why. I have include the css and the relevant table...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...

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.