Hi,
I'm working with the output of a database to make a drama script editable.
The php reads the chapter number and text inot two cells, which I then want to manipulate with javascript.
This is the php:
...which works as a plain echo "<tr> (etc), but breaks when the following javascript is used in an external file:PHP Code:<?php
require_once('mysql_login.php');
$query = "SELECT * FROM script";
$scripttxt = mysql_query($query);
//mysql_close();
echo "<table border='0'>";
echo "<tr> <th>Chapter</th> <th>Text</th></tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array($scripttxt)) {
// Print out the contents of each row into a table
echo "<tr onmouseover=\"editarea\"()\" style=\"display:none\"><td><strong>";
echo $row['chapter'];
echo "</strong></td><td>";
//construcr textfile
include ("Chapter0".$row['chapter'].".txt");
echo "</td></tr>";
}
echo "</table>";
?>
An example of what I am aiming for is on Netvibes, where the news sories show some options onmouseover and more functions onclick.Code:<script type="text/javascript"> function displayeditarea() { onmouseover="this.bgColor='#ffffff';"; onmouseout="this.bgColor='#FFCC66';"; onmouseover="edit.style.display = "";"; onmouseout="edit.style.display = "none";"; } </script>


Reply With Quote

Bookmarks