Invoking HTML?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Invoking HTML?

  1. #1
    Join Date
    Jun 2008
    Posts
    12

    Invoking HTML?

    I'm having some trouble here... I have a box that, when selected with Firebug, shows the following code:

    Code:
    <div class="StartBtn">
    <input type="image" tabindex="8" title="Get Free Quote!" alt="Get Free Quote!" src="images/quote_btn.gif">
    </div>
    Is there any way I can programmatically find and invoke this object? Like maybe loop through the classes and see if it matches "StartBtn"? I know of source like:

    Code:
    webbrowser1.Document.GetElementByID("btn").Invoke("click");
    But obviously that doesn't apply because there is no ID..?
    Last edited by Silo1337; August 9th, 2011 at 05:33 PM.

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,092

    Re: Invoking HTML?

    You could perhaps look into getElementsByTagName. But, GetElementByID is actually preferred, so you would need to add the ID attribute to that image in HTML code.

    Here is some info on getElementsByTagName :

    http://www.google.co.uk/search?q=get...ytagname&hl=en

  3. #3
    Join Date
    Jun 2008
    Posts
    12

    Re: Invoking HTML?

    Quote Originally Posted by HanneSThEGreaT View Post
    You could perhaps look into getElementsByTagName. But, GetElementByID is actually preferred, so you would need to add the ID attribute to that image in HTML code.

    Here is some info on getElementsByTagName :

    http://www.google.co.uk/search?q=get...ytagname&hl=en
    I had tried GEBTN a while back but wasn't actually able to get it to work. After following the link you supplied, I was able to find a site that explained it better than MSDN itself. Using the asterisk as the tagName allows me to loop through all of the elements, and now I'm simply clicking each element as it loops through. I think it works, but I'll have to do some testing.

    I'm somewhat confused as to how I can assign an ID to an element unless I'm simply doing something like element.Id = ID.

    Either way it goes, I appreciate the link you supplied me!

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,092

    Re: Invoking HTML?

    Quote Originally Posted by Silo1337 View Post
    I'm somewhat confused as to how I can assign an ID to an element unless I'm simply doing something like element.Id = ID.

    Either way it goes, I appreciate the link you supplied me!
    I'm glad I could help

    You need to set the ID in the HTML code, for example :
    Code:
    <Img Name="whatever" Width="whatever" Height="whatever" Alt="whatever" ID="whatever"></IMG>

  5. #5
    Join Date
    Jun 2008
    Posts
    12

    Re: Invoking HTML?

    Quote Originally Posted by HanneSThEGreaT View Post
    I'm glad I could help

    You need to set the ID in the HTML code, for example :
    Code:
    <Img Name="whatever" Width="whatever" Height="whatever" Alt="whatever" ID="whatever"></IMG>
    All right, so I've been able to solve my problem, but now I am having another. I have a report system setup on my site (can see it here: http://dontdoit.site90.com/contact/contact.html)

    I don't want my users to spam me, though, and would like to have some way I could know when the submit button was clicked. The report button on my form is disabled for two minutes when it's pressed, but now I need to make sure the user can't just backspace / refresh and keep submitting information over and over.

    Would there be some coding I could use to know WHEN the button is pressed so that I can simply close the report form and make the user wait two minutes before they use it again? Thanks!

  6. #6
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,092

    Re: Invoking HTML?

    make sure not to cache the file. look up META tags and caching

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center