|
5#
![](static/image/common/ico_lz.png)
楼主 |
发表于 2015-3-13 20:39:01
|
只看该作者
您好,感谢您的回答。我JS才上手...对JS面向对象写法不是很懂。我自己写了一段JS代码好像能实现上面php功能,但是感觉很累赘,不知有没简洁一点的方法~谢谢。- <script type="text/javascript">
- jQuery(document).ready(function(){
- $.ajax({
- type: "get",
- async: false,
- url: "outer.php",
- dataType: "json",
- jsonp: "callback",
- success: function(json){
- $.each(json,function(index,obj){
- $("#jjftdiv").append("<div id='b"+obj.id+"' class='con2'><div class='toolbar'><div class='back-to-top'><a href='#top'><span></span><img src='images/top.png' style='height:50px; width:50px; margin-right:-50px;margin-bottom:-20px'></a></div><a href='#jjft'><img src='images/top_jmnr.jpg' style='max-height:200px; max-width:200px; margin-left:-5px; margin-top:-2px'></a><a class='button back' href='#'></a></div><ul id='jjftsiz' align=center></ul><li><b>"+obj.title+"</b><br><br><p>播出时间:"+obj.time+" 时长:"+obj.length+"</p><br><video id='myVideo' controls poster='video.jpg' width='300' height='250' ><source src='video/"+obj.name+"' type='video/mp4' /><p>Your browser does not support the video tag.</p></video><span align=left>"+obj.content+"</span></li></div>");
- });
- },
- error: function(){
- alert('fail');
- }
- });
- });
- </script>
复制代码 |
|