php - Change att of the video to its corresponding item when you press the enter key -
i have application podcasts , accurate when press "enter" change attribute of corresponding item of video, can not reload page, change video. know how do?
javascript:
$.getjson("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3d'http%3a%2f%2frss.cnn.com%2fservices%2fpodcasting%2fac360%2frss.xml'%20and%20itempath%3d%22%2f%2fchannel%22&format=json&diagnostics=true&callback=?", function (data) { // load titles patch json console.log(data.query.results.channel.item); var titles = data.query.results.channel.item.map(function (item) { return item.title; }); var urls = data.query.results.channel.item.map(function (item) { return item.origlink; }); console.log(titles); $(".container-list-podcast ul").append('<li>' + titles.join('</li><li>')); $(".container-list-podcast ul li").each(function (key, value) { var text = $(this).text(); $(this).html('<a href="' + urls[key] + '">' + text + '</a>'); }); $(".container-list-podcast ul li a").click(function () { var href = $(this).attr('href'); alert(href); $("#myvideo").attr("src", href).get(0).play(); return false; }) // load navigation key = $('.nav_holder li').keynav(function () { return window.keynavigationdisabled; }); });
Comments
Post a Comment