Sign in to follow this  
Followers 0
redend

javascript onclick

5 posts in this topic

Hi,

I would like to click/submit one of the Calendar events on the below html code. Only those days where "calendar event" can be found.

E.g. "class="calendar event" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-05-11')">11</a></td>" this is the 11th May

Thanks in advance.

<div class="keresk_es_elszam_naptar" id="kereskedesNaptar" style="width:400px;height:85px">

<table border="0" cellpadding="0" cellspacing="0" class="naptar">

<thead>

<tr>

<th>h</th>

<th>k</th>

<th>sz</th>

<th>cs</th>

<th>p</th>

<th class="weekend">sz</th>

<th class="weekend">v</th>

<th class="weekSeparator"></th><th>h</th>

<th>k</th>

<th>sz</th>

<th>cs</th>

<th>p</th>

<th class="weekend">sz</th>

<th class="weekend">v</th>

<th class="weekSeparator"></th></tr>

</thead>

<tbody>

<tr>

<td class="calendar inactive" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-04-27')">27</a></td>

<td class="calendar inactive" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-04-28')">28</a></td>

<td class="calendar inactive" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-04-29')">29</a></td>

<td class="calendar inactive" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-04-30')">30</a></td>

<td class="calendar">1</td>

<td class="calendar weekend">2</td>

<td class="calendar weekend">3</td>

<td class="weekSeparator"></td><td class="calendar event" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-05-04')">4</a></td>

<td class="calendar event" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-05-05')">5</a></td>

<td class="calendar event" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-05-06')">6</a></td>

<td class="calendar event" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-05-07')">7</a></td>

<td class="calendar event" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-05-08')">8</a></td>

<td class="calendar weekend">9</td>

<td class="calendar weekend">10</td>

<td class="weekSeparator"></td></tr>

<tr>

<td class="calendar event" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-05-11')">11</a></td>

<td class="calendar event" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-05-12')">12</a></td>

<td class="calendar event" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-05-13')">13</a></td>

<td class="calendar event" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-05-14')">14</a></td>

<td class="calendar event" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-05-15')">15</a></td>

<td class="calendar weekend">16</td>

<td class="calendar weekend">17</td>

<td class="weekSeparator"></td><td class="calendar event" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-05-18')">18</a></td>

<td class="calendar event" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-05-19')">19</a></td>

<td class="calendar event" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-05-20')">20</a></td>

<td class="calendar event" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-05-21')">21</a></td>

<td class="calendar event" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-05-22')">22</a></td>

<td class="calendar weekend">23</td>

<td class="calendar weekend">24</td>

<td class="weekSeparator"></td></tr>

<tr>

<td class="calendar event active" onclick=""><a href="java script:fbrkRightSearchFormSubmit('2009-05-25')">25</a></td>

<td class="calendar">26</td>

<td class="calendar">27</td>

<td class="calendar">28</td>

<td class="calendar">29</td>

<td class="calendar weekend">30</td>

<td class="calendar weekend">31</td>

<td class="weekSeparator"></td><td class="calendar inactive">1</td>

<td class="calendar inactive">2</td>

<td class="calendar inactive">3</td>

<td class="calendar inactive">4</td>

<td class="calendar inactive">5</td>

<td class="calendar inactive">6</td>

<td class="calendar inactive">7</td>

<td class="weekSeparator"></td></tr>

</tbody>

</table>

</div>

Share this post


Link to post
Share on other sites



#include <IE.au3>

Global $oIE, $oDiv, $oTDs, $oTD


$oDiv = _IEGetObjById($oIE, 'kereskedesNaptar')
$oTDs = _IETagNameGetCollection($oDiv, 'td')

For $oTD In $oTDs
    If $oTD.className = 'calendar inactive' Then
        _IEAction($oTD, 'click')
        ExitLoop
    EndIf
Next
Thank you for your quick help, but here is the link where I want to click one of the active calendar days

http://www.magyartokepiac.hu/kereskedes/index.php

Hope it makes the troubleshoot easier.

Share this post


Link to post
Share on other sites

#include <IE.au3>

Global $oIE, $oDiv, $oTDs, $oTD
Global $aLink

$oIE = _IECreate('http://www.magyartokepiac.hu/kereskedes/index.php')
$oDiv = _IEGetObjById($oIE, 'kereskedesNaptar')
$oTDs = _IETagNameGetCollection($oDiv, 'td')

For $oTD In $oTDs
    If $oTD.className = 'calendar event' Then
        $oTD.scrollIntoView()
        Sleep(3000)
        $aLink = StringRegExp(_IEPropertyGet($oTD, 'innerhtml'), '(?i)<[^>]*>([^<]*)<', 1)
        If IsArray($aLink) Then _IELinkClickByText($oIE, $aLink[0])
        ExitLoop
    EndIf
Next

Share this post


Link to post
Share on other sites

#include <IE.au3>

Global $oIE, $oDiv, $oTDs, $oTD
Global $aLink

$oIE = _IECreate('http://www.magyartokepiac.hu/kereskedes/index.php')
$oDiv = _IEGetObjById($oIE, 'kereskedesNaptar')
$oTDs = _IETagNameGetCollection($oDiv, 'td')

For $oTD In $oTDs
    If $oTD.className = 'calendar event' Then
        $oTD.scrollIntoView()
        Sleep(3000)
        $aLink = StringRegExp(_IEPropertyGet($oTD, 'innerhtml'), '(?i)<[^>]*>([^<]*)<', 1)
        If IsArray($aLink) Then _IELinkClickByText($oIE, $aLink[0])
        ExitLoop
    EndIf
Next

Many thanks it is working. Have a nice day.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0