Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#32 Parse attribute 'onclick'

open
nobody
Functions (11)
5
2012-10-10
2012-07-31
Anonymous
No

Hi, I was using the last release of this class (1_5) and when I search an element with 'onclick' attribute it does not parses its content (onclick content), then I have to find other way to get what I need.
It would be a great feature in the next releases.
Thank you in advance.

Discussion

  • nickl-
    nickl-
    2012-09-11

    Can you please elaborate, please provide examples of the html and what you expect to get as well as what you are getting instead.

    From the html:
    <html>
    <head>
    </head>
    <body>

    </body>
    </html>

    I got the onclick already:

    php> $html = new simple_html_dom();
    php> $html->load_file('t.html');
    php> $res = $html->find('html/body/img');
    php> echo $res[0]->onclick
    JavaScript:alert('You clicked?');

    If it is not written in the html as per my example above there is no way for the parser to know about it as it is incapable of executing JavaScript in any way, I am afraid.