【问题标题】:how to set Image width and height in web browser in window phone 7?如何在 Windows Phone 7 的网络浏览器中设置图像宽度和高度?
【发布时间】:2011-07-12 18:28:40
【问题描述】:

在我的项目中,当我开始链接 http:// 从服务返回时,结构如下

链接 http 我通过以下方式添加到浏览器:

webBrowser.Source = new Uri(linkWeb);

我想在浏览器中获取元素 HTML!

如何在 HTML 中获取图片的 src 和图片的链接?

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
<head>
    <title>Advertisement</title>
    <script type='text/javascript'>
        setTimeout('window.location.replace(\"http://ads.diadiem.com:80/www/delivery/afr.php?refresh=10&zoneid=89&loc=\")', 10000);
    </script>
    <style type="text/css">
        body
        {
            margin: 0;
            height: 100%;
            background-color: transparent;
            width: 100%;
            text-align: center;
        }

        img
        {
            height: 50;
            width: 480;
        }
    </style>
</head>
<body>
    <a href='http://ads.com:80/www/delivery/ck.php?oaparams=2__bannerid=405__zoneid=89__cb=5bdb20fd07__oadest=http%3A%2F%2Fdownload.com'
            target='_blank'>
        <img src='http://ads.com:80/www/images/452c68d165d715b0984216bbf60627c0.jpg'
            width='320' height='55' alt='' title='' border='0' />
    </a>
    <div id='beacon_5bdb20fd07' style='position: absolute; left: 0px; top: 0px; visibility: hidden;'>
        <img src='http://ads.com:80/www/delivery/lg.php?bannerid=405&amp;campaignid=94&amp;zoneid=89&amp;loc=file%3A%2F%2F%2FApplications%2FInstall%2FCE8AC0B7-9103-4BCD-B9DE-BC3C1D10D814%2FInstall%2F&amp;cb=5bdb20fd07'
            width='0' height='0' alt='' style='width: 0px; height: 0px;' />
    </div>
</body>

我想得到

<img src='http://ads.diadiem.com:80/www/images/452c68d165d715b0984216bbf60627c0.jpg'
    width='320' height='55' alt='' title='' border='0' />

并设置高度和宽度,我想得到

href='http://ads.com:80/www/delivery/ck.php?oaparams=2__bannerid=405__zoneid=89__cb=5bdb20fd07__oadest=http%3A%2F%2Fdownload.com

【问题讨论】:

    标签: windows-phone-7


    【解决方案1】:

    假设您的代码中的 linkWeb 是图像的路径,
    试试:

    webBrowser.NavigateToString("<html><body><img src='" + linkWeb + "' height='100' width='200'></body></html>");
    

    【讨论】:

    • 感谢回复!但是,我想要获取 href 并调整宽度和高度,因为网络浏览器已加载完成。
    • @thongaduka 你是说你想在页面上加载内容,然后可能通过在 HTML 中设置显式值来调整高度和宽度?
    • 我想要因为服务返回给我一个网站链接!里面包含了一张图片和一个链接,不过那不介意480的大宽!所以我想出去改变图像大小并获得另一个链接,这样当我点击网络浏览器时就会显示另一个
    • @thongaduka 抱歉,我仍然不明白您要做什么。也许如果你展示了你迄今为止尝试过的东西,它可能会更清楚
    猜你喜欢
    • 2012-03-15
    • 1970-01-01
    • 2013-03-02
    • 1970-01-01
    • 2019-01-11
    • 2016-08-16
    • 2013-01-31
    • 2013-09-01
    • 1970-01-01
    相关资源
    最近更新 更多