0
單擊按鈕後,javascript在新選項卡上顯示結果。但是我想要將結果顯示在按鈕下方。在頁面上不顯示結果的Html單擊事件(使用javascript)
<html>
<body>
<input type="button" id="button1" value="Click Here" onclick="print();"/>
<script type="text/javascript"> //script to do some task
function print()
{
document.write('My Text Goes here ');
}
</script>
</body>
使用document.write不是一個好習慣。 –
旁邊它工作正常檢查這個小提琴:[http://jsfiddle.net/wk7cS/](http://jsfiddle.net/wk7cS/) –
http://stackoverflow.com/questions/9017754/open-in-新標籤與動態內容和http://stackoverflow.com/questions/427479/programmatically-open-new-pages-on-tabs可能對你有用 – KarSho