开发者

Jeditable not working on mouseover

开发者 https://www.devze.com 2023-03-06 08:55 出处:网络
I\'m working on a community drama website, and would like people to be able to make suggestions for editing a script.

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 = explo开发者_高级运维de('<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>


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\".

0

精彩评论

暂无评论...
验证码 换一张
取 消