Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass a Javscript Function

Status
Not open for further replies.

mtepfer

IS-IT--Management
Joined
Apr 21, 2003
Messages
55
Location
US
Scripting is not my thing but am trying to write one, have got it so it will log into our application and now i need to select a menuset, just have no idea where to begin on that. Any help is appreciated.

My login script looks like this :

Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "website"
IE.Visible = True
IE.Document.focus()
Wscript.Sleep 2000
IE.Document.All.Item("username").Value = "username"
IE.Document.All.Item("password").Value = "password"
IE.Document.All.Item("Button1").Click

Now i want to click on a menuset once inside the application, the code behind that looks like this, and for simplicity sake let's just say i want the first item called Belmont :

</td><td class=menuright nowrap>

<table border=0 cellspacing=0 cellpadding=2 class=menubar_links>
<tr><td align=right class=menubar_links>


<a href="JAVASCRIPT:Home()" class=menu>Home</a>&nbsp;
|
<a href="../iAdmin.asp?WCI=begin&action=logoff" target="filter" class=menu class=menu>Sign Out</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('Belmont')" class=menu>Belmont</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('ExecReports')" class=menu>Executive Menu</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('facmgr')" class=menu>WorkOrders/Inventory</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('finmgr')" class=menu>Financial Manager</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('FinReport')" class=menu>Financial Reports</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('FinUser')" class=menu>FinUser</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('FSSSpec')" class=menu>FSS Specialist</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('grantmgr')" class=menu>Grant Management</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('Police Inquiry')" class=menu>Police Inquiry</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('PropMgr')" class=menu>Property Manager</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('PropMgrnoPur')" class=menu>Property Admin</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('PropPur')" class=menu>WorkOrders/POs</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('PropUser')" class=menu>Property Users</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('purmgr')" class=menu>Purchasing</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('S8Mgrs')" class=menu>Assisted Housing Management</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('S8User')" class=menu>Assisted Housing User</a>&nbsp;
|
t_Admin&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('t_Affordable')" class=menu>Affordable</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('t_Assisted')" class=menu>t_Assisted</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('t_Budgeting')" class=menu>t_Budgeting</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('t_Commercial')" class=menu>t_Commercial</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('t_Construction')" class=menu>t_Construction</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('t_EPay')" class=menu>t_EPay</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('t_FacilManager')" class=menu>t_FacilManager</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('t_FinanMgr')" class=menu>t_FinanMgr</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('t_HAMgr')" class=menu>t_HAMgr</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('t_IData')" class=menu>IData</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('t_Inspection')" class=menu>t_Inspection</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('t_Leasing')" class=menu>t_Leasing</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('t_Manager')" class=menu>t_Manager</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('t_RentGearedToIncome')" class=menu>t_RentGearedToIncome</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('t_ResidentialMgr')" class=menu>t_ResidentialMgr</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('t_SiteManager')" class=menu>t_SiteManager</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('t_TaxCreditAssetMgmt')" class=menu>t_TaxCreditAssetMgmt</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('t_WaitList')" class=menu>WaitList Generation</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('Temp')" class=menu>Temporary Menu</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('THA Inquiry')" class=menu>THA Inquiry</a>&nbsp;
|
<a href="JAVASCRIPT:ChangeMenuSet('vendorsvc')" class=menu>vendorsvc</a>&nbsp;
</td></tr>
</table>
</html>
</DIV>

If anymor information is needed just let me know.
 
[tt]dim canchor, oanchor
with IE
set canchor=.document.getElementsByTagName("a")
for each oanchor in canchor
if strcomp(trim(oanchor.innerHTML),"Belmont",1)=0 then
oanchor.click
exit for
end if
next
end with
set oanchor=nothing
set canchor=nothing
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top