无法在文本区域中添加 "row numbers" 行

cannot add line of "row numbers" in textarea

我试着用这个例子向文本区域添加一行行号: http://alan.blog-city.com/jquerylinedtextarea.htm

这是我的代码,我已经在我的项目中使用了 css 和 js:

<!DOCTYPE html>
<html>
    <head>
        <title>CODE</title>
        <link href="jquery-linedtextarea.css" rel="stylesheet">
        <script src="jquery-linedtextarea.js"></script>
    </head>
    <body>
        <textarea class="lined" name="mytext"></textarea>
        <script>
            $(function () {
                $(".lined").linedtextarea(
                    { selectedLine: 1 }
                );
                $("mytext").linedtextarea();
            });
        </script>
    </body>
</html>

我错了什么?

你好像忘了打电话给Jquery图书馆...

只需将下面的代码添加到您的 <head>:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"> </script>

我认为你应该删除那部分:

$("mytext").linedtextarea();

我做了一个代码。这个对我有用。看看...

<html>
<head>
 <title>JQuery LinedTextArea Demo</title>
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
 <script src="http://files.aw20.net/jquery-linedtextarea/jquery-linedtextarea.js"></script>
 <link href="http://files.aw20.net/jquery-linedtextarea/jquery-linedtextarea.css" type="text/css" rel="stylesheet" />
</head>
<body>

<h1>JQuery LinedTextArea Demo</h1>

<p>Add a scrollable lined area to a standard TextArea control.</p>

<textarea class="lined" rows="10" cols="60">
JavaScript was originally developed by Brendan 
Eich of Netscape under the name Mocha, 
which was later renamed to LiveScript, 
and finally to JavaScript. 

The change of name from LiveScript to JavaScript roughly 
coincided with Netscape adding support for 
Java technology in its Netscape Navigator 
web browser.    

</textarea>

<script>
$(function() {
 $(".lined").linedtextarea(
  {selectedLine: 1}
 );
});
</script>


</body>
</html>