<form method=post action="go.php">
<input type="text" name="post_image" id="post_image" value="product/a1.jpg">
<img id="imgPath" src="product/a1.jpg" width="100" height="100" alt="">
</form><span onclick='getRadio()'>
<div><input type='radio' value=./product/a1.jpg name='radioImagPath'><a href=./product/a1.jpg><img width='100' height='100' src=./product/a1.jpg></a></div>
<div><input type='radio' value=./product/a2.jpg name='radioImagPath'><a href=./product/a2.jpg><img width='100' height='100' src=./product/a2.jpg></a></div>
<div><input type='radio' value=./product/a3.jpg name='radioImagPath'><a href=./product/a3.jpg><img width='100' height='100' src=./product/a3.jpg></a></div>
<div><input type='radio' value=./product/a4.jpg name='radioImagPath'><a href=./product/a4.jpg><img width='100' height='100' src=./product/a4.jpg></a></div>
</span>问题1、这个getRadio()函数怎么写,就能让上面的img能正常显示换图片,input也能换图片。
问题2、这个go.php怎么写就可以取到正确的值:$_POST["post_image"};

解决方案 »

  1.   

    go.php$post_image = $_POST["post_image"}; 
      

  2.   


    <form name="form1" method=post action="go.php">
    <input type="text" name="post_image" id="post_image" value="product/a1.jpg">
    <img id="imgPath" src="product/a1.jpg" width="100" height="100" alt="">
    </form><span>
    <div onclick="document.form1.post_image.value=document.getElementById('r1').value;document.form1.submit();"><input type='radio' value=./product/a1.jpg name='radioImagPath' id="r1"><a href=./product/a1.jpg><img width='100' height='100' src=./product/a1.jpg></a></div>
    <div onclick="document.form1.post_image.value=document.getElementById('r2').value;document.form1.submit();"><input type='radio' value=./product/a2.jpg name='radioImagPath' id="r2"><a href=./product/a2.jpg><img width='100' height='100' src=./product/a2.jpg></a></div>
    <div onclick="document.form1.post_image.value=document.getElementById('r3').value;document.form1.submit();"><input type='radio' value=./product/a3.jpg name='radioImagPath' id="r3"><a href=./product/a3.jpg><img width='100' height='100' src=./product/a3.jpg></a></div>
    <div onclick="document.form1.post_image.value=document.getElementById('r4').value;document.form1.submit();"><input type='radio' value=./product/a4.jpg name='radioImagPath' id="r4"><a href=./product/a4.jpg><img width='100' height='100' src=./product/a4.jpg></a></div>
    </span>
      

  3.   

    <form name="form1" method=post action="go.php">
    <input type="text" name="post_image" id="post_image" value="product/a1.jpg">
    <img id="imgPath" src="product/a1.jpg" width="100" height="100" alt="">
    </form> <span>
    <div onclick="document.form1.post_image.value=document.getElementById('r1').value;document.form1.imgPath.src=document.getElementById('r1').value;"><input type='radio' value=./product/a1.jpg name='radioImagPath' id="r1"><a href=./product/a1.jpg><img width='100' height='100' src=./product/a1.jpg></a></div>
    <div onclick="document.form1.post_image.value=document.getElementById('r2').value;document.form1.imgPath.src=document.getElementById('r2').value;"><input type='radio' value=./product/a2.jpg name='radioImagPath' id="r2"><a href=./product/a2.jpg><img width='100' height='100' src=./product/a2.jpg></a></div>
    <div onclick="document.form1.post_image.value=document.getElementById('r3').value;document.form1.imgPath.src=document.getElementById('r3').value;"><input type='radio' value=./product/a3.jpg name='radioImagPath' id="r3"><a href=./product/a3.jpg><img width='100' height='100' src=./product/a3.jpg></a></div>
    <div onclick="document.form1.post_image.value=document.getElementById('r4').value;document.form1.imgPath.src=document.getElementById('r4').value;"><input type='radio' value=./product/a4.jpg name='radioImagPath' id="r4"><a href=./product/a4.jpg><img width='100' height='100' src=./product/a4.jpg></a></div>
    </span>