我沒有使用任何JavaScript插件,用JavaScript編輯並更新數組值?
<html>
<head>
<title>sample dynamic select list</title>
<script language='javascript'>
function changeContent(tablecell)
{
tablecell.innerHTML = "<INPUT type=text name=newname onBlur=\"javascript:submitNewName(this);\" value=\""+tablecell.innerHTML+"\">";
tablecell.firstChild.focus();
}
function submitNewName(textfield)
{
textfield.parentNode.innerHTML= textfield.value;
}
</script>
</head>
<?php
$exrate = array("USD"=>array('sale'=>123,"buy"=>456))
?>
<body>
Double click on any cell. Then enter your own text and then tab out or click on other place.
<table border=1 bgcolor=gray>
<tr>
<th>Currency</th>
<th>Buy</th>
<th>Sale</th>
</tr>
<tr>
<td>USD</td>
<td onDblClick="javascript:changeContent(this);"><?=$exrate["USD"]["sale"]?></td>
<td onDblClick="javascript:changeContent(this);"><?=$exrate["USD"]["buy"]?></td>
</tr>
</table>
</body>
</html>
當任一單元格,雙擊然後輸入自己的文字,然後從選項卡或點擊其他place.so我怎麼能在一個陣列更新這些數據例如商店,可以在每次編輯時存儲值?
我不確定你在說什麼,但是你創建了一個數組,然後在每次編輯時推送這個值'array.push(newvalue)' – Ibu 2011-05-30 20:19:01