[問題] javascript 取得變數?
<html>
<head>
</head>
<body>
<form name="number">
您要看那一集呢?<input type="text" name="number1" size=3><p>
<input type="sumit" name="YEs"
onclick="document.location.href='" rel="nofollow">http://www.kimo.com.tw/xxx.pdf'">
</form>
</body>
</html>
請問要怎麼把集數帶到xxx.pdf
讓使用者按下Yes時
網頁會自動跑到指定的集數檔呢?
有查到
document.number.number1.value
很像可以取得表單裡文字的值
但…沒用
--------
<html>
<head>
</head>
<body>
<form name="number">
您要看那一集呢?<input id="num" type="text" name="number1" size=3><p>
<input type="sumit" value="yes"
onclick="document.location.href='" rel="nofollow">http://www.edu.tw/aaaa'+document.getElementById('num').value+'.pdf'">
</form>
</body>
</html>
--
很奇怪的誤打誤撞解決了
正確的語法應該是<input type="submit"
但我打成sumit卻跑出我要的結果
而打正確的submit時
卻沒反應
不知是不是submit和onclick不能同時用
那我是不是要改成什麼onmouseXXX的
就是當滑鼠碰到"送出"的按鈕時
就自動轉址
這樣就不會有submit和onclick衝突的情況了?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 163.27.107.1
※ 文章網址: https://www.ptt.cc/bbs/Web_Design/M.1462201646.A.E7E.html
推
05/02 23:59, , 1F
05/02 23:59, 1F
※ 編輯: mlev (163.27.107.1), 05/03/2016 00:22:01
推
05/03 01:05, , 2F
05/03 01:05, 2F
推
05/03 12:42, , 3F
05/03 12:42, 3F
噓
05/07 01:03, , 4F
05/07 01:03, 4F
→
05/07 01:03, , 5F
05/07 01:03, 5F
Web_Design 近期熱門文章
PTT數位生活區 即時熱門文章