我正在制作一个社区戏剧网站,希望人们能够为编辑剧本提出建议。
目前这只是一个例子,但流程如下:
所以我有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>
答案 0 :(得分:0)
您需要将要编辑的div指定为具有类鼠标悬停。因此,当您回显<div class=\"edit_area\"
时,您应该将其<div class=\"edit_area mouseover\"
。