如何从源头获取图像?

Hom*_*mam 1 html javascript jquery find

如何编写客户端javascript来获取源代码的图像?

use*_*716 5

页面上的图像?

你可以用jQuery做到这一点:

<body>
    <!-- your content including the image -->

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
    <script type="text/javascript">
        $(function() {
            var myimg = $('img[src="/some/path/to/img.jpg"]');
        });
    </script>
</body>
Run Code Online (Sandbox Code Playgroud)

这使用tag-selector(docs)attribute-equals-selector(docs)来获取匹配所需源的img元素src.