|
|
本帖最后由 qwerrrr 于 2015-9-15 17:22 编辑
网页源码内容:
var videoInfo = {"id":129171994,"v_intro":"","md5file":"807576b4d90245b817d714f71fe08039","save_time":1414928319,"public_time":0,"movie":{"chk_yn":"d","copyright":"n","class1":"e"},"tags2":"","user_id":"qq-yvodearhzn","rela_opera":-4,"public":"y","opera_id":-4,"extends":{"v_intro":""},"tags1":"","tags":"\u6dd8\u5b9d,,,,","tag":"\u6dd8\u5b9d,,,,","exercise":"n","tags3":"","effectID":"0","tags0":"\u6dd8\u5b9d","cid":3,"Content":"","normal_file":"http:\/\/c180.56.com\/flvdownload\/16\/26\/141492831948hd.flv","img":"http:\/\/v11.pfs.56img.com\/images\/22\/29\/qq-yvodearhzni56olo56i56.com_141492831948hd.jpg","chk_yn":"y","totaltime":30063,"Subject":"AAAAAAAAAAAAAAA","tags4":"","nickName":"\u6dd8\u5b9d\u65b0\u5e97\u94fa\u65b0\u54c1","userPhoto":"http:\/\/uface.56img.com\/photo\/temp\/60\/head_5.jpg","rawSubject":"AAAAAAAAAAAAAAA","channelInfo":{"name":"\u539f\u521b","img":"http:\/\/www.56.com\/admin\/images\/sort1.jpg","note":"\u539f\u521b\u89c6\u9891,\u7f51\u7edc\u7ea2\u4eba,\u52a8\u753b,\u52a8\u6f2b,dv","url":"http:\/\/dv.56.com","page":"http:\/\/dv.56.com\/"},"user_name":"\u6dd8\u5b9d\u65b0\u5e97\u94fa\u65b0\u54c1","user_face":"http:\/\/uface.56img.com\/photo\/4\/77\/qq-yvodearhzn_b_56.com_.jpg","EnId":"MTI5MTcxOTk0","mid":0,"isCopyRight":false,"flv_path":"http:\/\/f4.r.56.com\/f4.c181.56.com\/flvdownload\/19\/29\/141492831948hd_clear.flv"};
我想获取:"totaltime"这个后面的值,为什么会出错。
方法1
var totaltime=substring(indexof(","totaltime":",","Subject":");
var t=Math.ceil(totaltime/1000);
方法2
var t=Math.ceil(videoInfo.totaltime/1000);
都会出错..
javascript error Math( ).1为空或不是对象 location(6,0)
谁知道怎么做?提取出数值。。 |
|