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: Joacim Mårtensson Date: July 8, 2003

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