WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 Rownumbers, is it possible?, Johan Hallberg, July 4, 2003
     Re:Rownumbers, is it possible?, Joacim Mårtensson, July 8, 2003
         Re:Rownumbers, is it possible? , Johan Hallberg, August 4, 2003
         Re:Rownumbers, is it possible?, Erik Arvidsson, July 8, 2003
             Re:Rownumbers, is it possible?, Joacim Mårtensson, July 8, 2003
                 Re:Rownumbers, is it possible?, Erik Arvidsson, July 8, 2003
         Re:Rownumbers, is it possible?, Joacim Mårtensson, July 8, 2003

Subject: Re:Rownumbers, is it possible? From: Erik Arvidsson Date: July 8, 2003
Does anyone know how to get around the IE undo bug?

IE looses the undo capability when the content model (in any window connected to the current editor) is changed by script.

erik

________________________________________________________

Yes.. and a few other bugs to. Like it does not add line-numbers until the last line contains any characters.
Hopefully someone else can rewrite the function so It suit the needs Johan needs.
But its a start :)

From: Erik Arvidsson
Sent: July 8, 2003
Subject: Re:Rownumbers, is it possible?

Not bad... however it triggers the classic IE undo bug :'(

erik

_______________________________________________________

I tested little i IE and this is a function i ended up with. Im sure that others can do this better but here it is:

<html>
<head>
<title></title>
</head>
<style>
p {
margin: 0px;
}
</style>
<script>
function linenumbers() {
linenr.innerHTML = "";
var string = codetext.innerText;
var substrings = string.split("\n");

for (i = 0; i < substrings.length; i++) {
linenr.innerHTML = linenr.innerHTML + (i+1) * 10 + "<br>";
}
}
</script>
<body onload="linenumbers();">
<button onclick="alert(codetext.innerText);">Show innerText</button><br><br>
<span id="linenr" style="width: 28px; text-align: right; position: absolute; left: 10px; background-Color: #cccccc;"></span >
<div onkeypress="linenumbers();" CONTENTEDITABLE id="codetext" style="background-Color: #ccccff; position: absolute; left: 40px;">
PRINT "HELLO WORLD"<br>
GOTO 10
</div>
</body>
</html>

From: Johan Hallberg
Sent: July 4, 2003
Subject: Re:Rownumbers, is it possible?

I was thinking, is it possible to add row numbers to the div tag here under that get dynamically updated during typing (like in an ordinary code editor)? With a possibility putting them in an diferent div/span for the ability of original content extraction utilizing innerHTML, still enabling page scrolling in a normal fassion?
10 PRINT "HELLO WORLD"
20 GOTO 10










Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX