日期:2014-05-17  浏览次数:20834 次

json 的数据如何赋值给<img>标签的src
{"userCarNum":" ","ipAddr":"192.168.133.241","phone":" ","portNum":"50000","carFlag":"1","comeTime":"2013-07-22 21:08:56","vipFlag":"0","deviceNum":"1","imgUrl":"C:\\Program Files (x86)\\Apache Software Foundation\\Tomcat 7.0\\webapps\\ParkingSystem\\images\\192.168.133.241_50000_2.jpg","carNum":"鄂C23789","description":"","userName":" ","spotId":"P0001"}


这是拿到的json的数据 我想把 imgUrl 赋值给我页面上的<img>标签的src  我用了${imgUrl}这样不行么 哪应该怎么做呢

下面是struts的xml
<action name="get_parksById" class="com.park.action.ParkAction" method="loadParksById">
            <result type="json">  
                <param name="root">jsonParkInfo</param>  
            </result>  
</action>
json,<img>标签

------解决方案--------------------

你JSON怎么取得的?AJAX吗?那样的话用JS来赋值呀!