如何获取图像网址并将它们放到json中

时间:2013-07-30 14:53:36

标签: json

我在一个漫画网站的html源代码中有该代码:

<script type="text/javascript">

        var lstImages = new Array();

            lstImages.push("http://2.bp.blogspot.com/-5NLcgCIQh30/Ufd_W-enrZI/AAAAAAAGf1w/ocQIliNmsG4/001Afternoon-000.jpg?imgmax=2000");

            lstImages.push("http://2.bp.blogspot.com/-kjk6vTGGhCA/Ufd_XquNpII/AAAAAAAGf14/jv0w6T0IYHM/001Afternoon-002.jpg?imgmax=2000");

            lstImages.push("http://2.bp.blogspot.com/-fBI39AzdBhI/Ufd_YqX3-PI/AAAAAAAGf2A/8XY8znlaptQ/001Afternoon-003.jpg?imgmax=2000");

            lstImages.push("http://2.bp.blogspot.com/-CcXasNtgM2o/Ufd_Zo7SyrI/AAAAAAAGf2I/9D6GXFUI59E/001Afternoon-004.jpg?imgmax=2000");

            lstImages.push("http://2.bp.blogspot.com/-wXq4VEhZcb4/Ufd_aSnkrbI/AAAAAAAGf2Q/AMj6hkezGK8/001Afternoon-005.jpg?imgmax=2000");

            lstImages.push("http://2.bp.blogspot.com/-Z3qIiIm1jzo/Ufd_bSg7kLI/AAAAAAAGf2Y/Svpe8Ferpv8/001Afternoon-006.jpg?imgmax=2000");

            lstImages.push("http://2.bp.blogspot.com/-oVJIp5dNAcE/Ufd_cSDOIAI/AAAAAAAGf2g/cs8iCyFW08E/001Afternoon-007.jpg?imgmax=2000");

            lstImages.push("http://2.bp.blogspot.com/-3eWO4MsOg50/Ufd_ddGON_I/AAAAAAAGf2o/Uh2C6ohInI4/001Afternoon-008.jpg?imgmax=2000");

            lstImages.push("http://2.bp.blogspot.com/-HV47RhiVLUI/Ufd_eDGb0jI/AAAAAAAGf2w/Iq1YLP5g_hE/001Afternoon-009.jpg?imgmax=2000");

            lstImages.push("http://2.bp.blogspot.com/-Uu0hL2CUAsI/Ufd_fKHVFZI/AAAAAAAGf24/PxD7jFPHlFs/001Afternoon-010.jpg?imgmax=2000");


        var currImage = 0;            

        $('#divImage img[src=""]:first').attr('src', lstImages[currImage]);

        currImage++;

        $('#divImage img[src=""]:first').attr('src', lstImages[currImage]);

        currImage++;

        $('#divImage img').load(function(){            
            if (currImage < lstImages.length)
            {
                $('#divImage img[src=""]:first').attr('src', lstImages[currImage]);
                currImage++;
            }      
            else

                $('#pLoading').hide();
        });         

        $('#selectReadType').change(function () {
            document.cookie = "vns_readType=" + $(this).val() + "; expires=Thu, 2 Aug 2020 20:47:11 UTC;path=/;domain=.truyen.vnsharing.net";
            window.location.reload();
        });

        $('#aCannotRead').click(function(){

            if (confirm("Nhấn vào đây là sẽ đọc trên server CTD = chậm như RÙA. VnSharing khuyến khích các bạn đọc hướng dẫn đổi DNS để đọc trên Picasa = NHANH"))

            {
                document.cookie = "vns_cannotread=1;path=/";
                window.location.reload();
            }
        });


        $('#aRead').click(function(){ 
                document.cookie = "vns_cannotread=0;path=/";
                window.location.reload();
        });


        $('.selectChapter').change(function () {
            location.href = 'http://truyen.vnsharing.net/Truyen/Afternoon/' + $(this).val();
        });


        $('.selectGroup').change(function () {
            location.href = 'http://truyen.vnsharing.net/Truyen/' + $(this).val();
        });


        function NextChap() {
            $('#divImage').empty();
            $('#divMsg').css('display', 'block');
        }     

</script>

我想获取所有图片网址并将其设置为json类型。但我不知道如何修剪图片网址(例如:http://2.bp.blogspot.com/-5NLcgCIQh30/Ufd_W-enrZI/AAAAAAAGf1w/ocQIliNmsG4/001Afternoon-000.jpg)。

0 个答案:

没有答案