2
我試圖用cytoscape顯示圖形查詢的結果。我不是JavaScript的專家,所以也許這只是一個語法錯誤,有人可以看看我的代碼?從php代碼創建cytoscape樹
<script type="text/javascript">
window.onload = function() {
// id of Cytoscape Web container div
var div_id = "cytoscapeweb";
// NOTE: - the attributes on nodes and edges
// - it also has directed edges, which will automatically display edge arrows
var xml = '\
<graphml>\
<key id="label" for="all" attr.name="label" attr.type="string"/>\
<key id="weight" for="node" attr.name="weight" attr.type="double"/>\
<graph edgedefault="directed">\
<node id="1">\
<?php echo "<data key=\"label\">$prot</data>\\\n";?>
<data key="weight">2.0</data>\
</node>
<?php $count=2;?>
<?php while($row = mysql_fetch_array($result)){
echo "<node id=\"$count\">\\";
echo "<data key=\"label\">$row['interactor']</data>\\";
echo "<data key=\"weight\">1.0</data>\\";
echo "</node>\\";
echo "<edge source="1" target=\"$count\">\\";
echo "<data key=\"label\">$prot to $row['interactor']</data>\\";
echo "</edge>\\";
$count++;
}?>
</graph>\
</graphml>\
';
你看到了什麼行爲?任何錯誤消息? – ernie