drudfe0446838 2016-05-23 11:49 采纳率: 0%
浏览 49
已采纳

如何在php中获取和打印页面中的图像

I want to print the image within the page. here is my code

<form method="post" action="" enctype="multipart/form-data">
    <input type="radio" value="<img src='images/image1.jpg'>">
    <img src="images/image1.jpg" width="50px" height="50px"><br/>
    <input type="radio" value="<img src='images/image2.jpg'>">
    <img src="images/image2.jpg" width="50px" height="50px"><br/>
    <input type="radio" value="Both" />Both<br/>
</form>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
    $("input:radio[type=radio]").click(function(){
        var value = $(this).val();
        $('#showoption').val(value);
    });
</script>

<label>Value</label>     
<input type="text" id="showoption" name="name" disabled="disabled">   
</label>

When I click on selected radio button the image it prints the image url. how to print the selected image.

</div>
  • 写回答

1条回答 默认 最新

  • duanjie5570 2016-05-23 11:54
    关注

    You are getting exact image tag with src so what you need to do is just put it in some HTML in page. So i change the input box with div and now on click the div will be fill with Image tag.

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript">
    $("input:radio[type=radio]").click(function() {
    var value = $(this).val();
    $('#showoption').html(value);
        });
    </script>
    
    <label>Value</label>
    
    <div id="showoption"></div>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧