Jeditable 在鼠标悬停时不起作用

发布于 2024-11-06 20:28:15 字数 1695 浏览 1 评论 0 原文

我正在一个社区戏剧网站上工作,希望人们能够提出编辑剧本的建议。

目前这只是一个示例,但流程如下:

  1. 从(《回到未来》的电影剧本)中获取一部分文本,
  2. 行之间由

    分隔
  3. 然后在 PHP 中展开,
  4. 每一行都应该是可编辑的,可编辑。
  5. 并且输出应该从另一个页面发送到数据库

所以我的第 1-3 行可以正常工作,但我在编辑功能方面遇到了困难。 代码如下(摘录):

<?php
//retrieve data
require_once('mysql_login.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Edit the Script</title>
<script src="Scripts/jeditable.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
     $(".mouseover").editable("http://localhost/milton/save.php", {
tooltip   : "Move mouseover to edit...",
      event     : "mouseover",
      style  : "inherit"
    });
});
</script>
</head>

<body>
<div id="chapter02">
    <h2>Chapter Two</h2>
    <?php
    $scriptText = "Chapter02.txt";
    $fh = fopen($scriptText, 'r') or die("Can't open file");
    $text=fread($fh, filesize($scriptText));
    $lines = explode('<p>',$text);
    //$lines = explode('<p>',$scriptText);
    echo "Chapter 2 has ".count($lines)." lines.<p>";
    // loop through and print all the words
    for ($i = 0; $i < count($lines); $i++)
    {
        $lineNumber = $i+1;
        if 
        echo '<div class=\"edit_area\" id=\"div_'.$i.'\">'.'Line ' . $lineNumber . ' - ' . $lines[$i] . '</div>';
    }
    ?>
</div>
</body>
</html>

I'm working on a community drama website, and would like people to be able to make suggestions for editing a script.

It's just an example at the moment, but the flow is as follows:

  1. Get a portion of text from (the movie script to Back to the Future)
  2. The lines are delimited by a
  3. This is then exploded in PHP
  4. each line should then be editable, with jeditable.
  5. and the output should be sent to a database from another page

So I've got lines 1-3 to work okay, but I'm struggling with the edit functions.
The code is as follows (extract):

<?php
//retrieve data
require_once('mysql_login.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Edit the Script</title>
<script src="Scripts/jeditable.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
     $(".mouseover").editable("http://localhost/milton/save.php", {
tooltip   : "Move mouseover to edit...",
      event     : "mouseover",
      style  : "inherit"
    });
});
</script>
</head>

<body>
<div id="chapter02">
    <h2>Chapter Two</h2>
    <?php
    $scriptText = "Chapter02.txt";
    $fh = fopen($scriptText, 'r') or die("Can't open file");
    $text=fread($fh, filesize($scriptText));
    $lines = explode('<p>',$text);
    //$lines = explode('<p>',$scriptText);
    echo "Chapter 2 has ".count($lines)." lines.<p>";
    // loop through and print all the words
    for ($i = 0; $i < count($lines); $i++)
    {
        $lineNumber = $i+1;
        if 
        echo '<div class=\"edit_area\" id=\"div_'.$i.'\">'.'Line ' . $lineNumber . ' - ' . $lines[$i] . '</div>';
    }
    ?>
</div>
</body>
</html>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秋风の叶未落 2024-11-13 20:28:15

您需要将要编辑的 div 指定为具有类 mouseover。因此,在您回显

的地方,您应该将其设置为

You need to specify the div you want to edit as having class mouseover. So where you echo <div class=\"edit_area\", you should make it <div class=\"edit_area mouseover\".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文