简体   繁体   中英

C# Web browser - How to click this button (Javascript)

I went through many discussions and I wasted over 1 hour trying to do something with this. But I didn't find the solution.. so.. I have this html piece of code and I need to trigger that javascript thing I've red lined.. I tried to trigger it through chrome, it went with no probs when I put it in the console and entered..

I need to know, how to trigger this in c# web browser. (I am kinda new to programming, I never studied the HTML or javascript, I just can do small things in c# - so I don't know much about those elements etc)

I need to trigger this thing - javascript:Skylab.sendTransport('normal');

Any idea how ?

Screen with the code in colors: http://i.stack.imgur.com/NLDjZ.png

<div id="transport_right">
<table>
    <tr>
        <td style="width:41px;"><img id="to_skylab" src="http://do-test.a.bpcdn.net/do_img/global/pilotSheet/skylab/to_skylab_0.png?__cv=1f08c141b032cd3f3800247fe3f58100" width="41" height="36"></td>
        <td style="width:23px;"><img id="but_to_skylab" src="http://do-test.a.bpcdn.net/do_img/global/pilotSheet/skylab/but_right_0.png?__cv=ac1391c5509c09a46cc9bd5e36c51400" width="17" height="17"></td>
        <td style="width:29px"><img id="to_ship" src="http://do-test.a.bpcdn.net/do_img/global/pilotSheet/skylab/to_ship_0.png?__cv=b76cfb40c24b488ac9f685627faad600" width="29" height="36"></td>
    </tr>
    <tr>
        <td colspan="3" style="padding-top:20px;">
            <div class="button_standard">
                <a style="display:block" onfocus="this.blur()" href="javascript:Skylab.sendTransport('fast', 'Chceš tento transport skutečně zahájit?','OK','Storno');">ihned odeslat</a>
            </div>
        </td>
    </tr>
    <tr>
        <td colspan="3" style="padding-top:5px;"><strong>1187 U.</strong></td>
    </tr>
    <tr>
        <td colspan="3" style="padding-top:25px;">
            <div class="button_standard">
                <a style="display:block" onfocus="this.blur()" href="javascript:Skylab.sendTransport('normal');">odeslat</a>
            </div></td>
    </tr>
</table>

您应该使用属性OnClick而不是href,并将href设置为#:

<a style="display:block" onfocus="this.blur()" href="#" onclick="Skylab.sendTransport('normal');">odeslat</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM