看板 PHP 關於我們 聯絡資訊
<body> <tr> <?php for ($i = 1; $i <= 26; $i ++) { echo '<td>'. $i .'</td>'; } ?> </tr> <tr> <?php for ($j = 1; $j <= 26; $j ++) { echo '<td><img src="01.gif" rel="01.gif,02.gif,03.gif" name="vid_chk" id="vid_chk'. $j .'" value="1" /></td>'; } ?> <script type="text/javascript"> //切換圖片 (function () { var imgs = document.getElementsByTagName('img'); for (var i=0,L=imgs.length; i<L; i++) { var img = imgs[i], rel = img.getAttribute('rel'); img.pic = rel && rel.split(/\s*,\s*/) || []; img.current = 0; img.onclick = function(){ this.current++; if (this.current >= this.pic.length) {this.current = 0;} this.src = this.pic[this.current]; } } })(); </script> </tr> <body> 我要做一行26格的圖片切換選項 現在圖片是可以切換了,但是我現在需要把圖片變成一個值然後傳出去 就好比我在第一格我圖片切換到02.gif,圖片會送出值value=1 當按下送出按鈕,如果第一格圖片是02.gif值是1,最後按下送出是一長串26個數字 好比10000000000000000000000000(0就當作是01.gif的值為預設值) 真不知道圖片要怎傳值出去,麻煩解惑 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.27.75.206
iceblue7x:img沒有value屬性 你可以每張圖配1個 hidden input 08/20 22:40
earth999:type=hidden id="" value=../01.gif ? 08/21 11:23
earth999:$gif_1=$_POST['gif_1']; $gif_1=1; 這樣? 08/21 11:24
Bambe:樓上,name不見了 Orz 08/21 12:48
earth999:我回文沒打上 但實際程式碼上有 08/21 13:02