<style> form { border: 1px solid gray; padding: 10px; width: 300px; display: inline-block; } </style> <h1>亂數骰子大亂鬥-看誰數字大</h1> <form id='pcform'> <h2>電腦先骰</h2> 第 1 顆:<input type="text" name="pc1" value="" size="3" readonly='readonly' /><br /> 第 2 顆:<input type="text" name="pc2" value="" size="3" readonly='readonly' /><br /> 第 3 顆:<input type="text" name="pc3" value="" size="3" readonly='readonly' /><br /> <input type="button" value="重玩一遍" name='pcinp' onclick='pcgo()' /> </form> <form id='myform'> <h2>換我來骰囉!</h2> 第 1 顆:<input type="text" name="my1" value="" size="3" readonly='readonly' /><br /> 第 2 顆:<input type="text" name="my2" value="" size="3" readonly='readonly' /><br /> 第 3 顆:<input type="text" name="my3" value="" size="3" readonly='readonly' /><br /> <input type="button" onclick='mygo()' value="開始骰下去" name='myinp' /> </form> <div id='ans'></div>