- 代碼: 選擇全部
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>test</title>
<script type="text/javascript">
/* <![CDATA[ */
function changeact(id) {
var subname = 'after_number';
var testobj = document.getElementById('ftest');
var objectaction = 'http://localhost'+id+'/'+subname;
testobj.setAttribute('action', objectaction);
};
/* ]]> */
</script>
</head>
<body>
<form id="ftest" action="#">
<label>test radioes:
<input type="radio" onclick="changeact('');" />m0
<input type="radio" onclick="changeact('1');" />m1
<input type="radio" onclick="changeact('2');" />m2
<input type="radio" onclick="changeact('3');" />m3
</label><br />
</form>
<form id="ftest2" action="#">
<label>test radioes:
<input type="radio" />p0
<input type="radio" />p1
<input type="radio" />p2
<input type="radio" />p3
</label>
</form>
</body>
</html>
想問下有咩問題,無論選咗邊一個選項都好,最終個form嘅action都係"http://localhost/after_number"
點改先搞到佢可以係localhost後出到數字?
另外係選咗一個選項之後就唔可以選第二個,搞到永世都係m0...