Results 1 to 3 of 3

Thread: How to get VBScript to Click that Javascript Button?

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2012
    Posts
    2

    How to get VBScript to Click that Javascript Button?

    Hey Guys,

    i am writing a VBScript Tool for some work, that should be automatic.
    I am struggling at gettin my VBScript to get a Link clicked:

    HTML Source:
    <td rowspan='3' align='right'><a href='#' onClick='SearchHosts(escape(document.formular_search.search_area.value), escape(document.formular_search.search_area2.value), escape(document.formular_search.search_area3.value), 0); ClearDetails(); return false;'><img src='/modules/mod_maintenances2/images/link_search_big.png' border='0' alt='Suchen'></a></td>

    I tried to navigate to the javascript function to call it, but it didnt work or i did it wrong
    Any suggestion?
    Over the alt it doesn t work, because its not unique in the source code.

    I tried like
    IE.Navigate("javascript:SearchHosts();")
    or
    IE.Document.parentWindow.SearchHosts()
    or
    IE.Document.All.Item("SearchHosts").Click

    I am thankful for any helps.

    Best Regards.

  2. #2

    Thread Starter
    New Member
    Join Date
    Apr 2012
    Posts
    2

    Re: How to get VBScript to Click that Javascript Button?

    Ok, got the solution.
    For anyone interested:
    For Each Button In IE.Document.getElementsByTagName("a")
    If InStr(Button.getAttribute("onclick"), "SearchHosts") Then
    Button.Click
    Exit For
    End If

  3. #3
    New Member
    Join Date
    Aug 2012
    Posts
    1

    Re: How to get VBScript to Click that Javascript Button?

    I am trying to create a VBScript that will save my notes from OneNote to a WebPage. I have the IE page open and can add all my notes and information into the correct fields, but I can't figure out the code to invoke the Save button. I have identified the field ID as "bottomButtonRow", but when I try to perform the following code it does nothing:


    ie.document.GetElementByID("bottomButtonRow").click

    Here is the section of information on the page that shows the "Save" info (javascript)

    <tr class="detailRow last"><td colspan='4'><input type="hidden" id="followup" name="followup" value="1" /></td></tr></table></div></div><div class="pbBottomButtons"><table border="0" cellpadding="0" cellspacing="0"><tr><td class="pbTitle"><img src="/s.gif" alt="" width="1" height="1" class="minWidth" title="" />&nbsp;</td><td class="pbButtonb" id="bottomButtonRow"><input value=" Save " class="btn" name="save" tabindex="33" title="Save" type="submit" /> <input value="Cancel" class="btn" name="cancel" tabindex="34" title="Cancel" type="submit" /></td></tr>
    </table></div><div class="pbFooter secondaryPalette"><div class="bg"></div></div></div><script type="text/javascript">if (window.tpdPage && window.tpdPage.initBtns) { window.tpdPage.initBtns(["save","cancel"]); }</script></form><script type="text/javascript">pklist.initAll()</script>

    Any help would be greatly appreciated.

Posting Permissions

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



Click Here to Expand Forum to Full Width