Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9003861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:46:03+00:00 2026-06-16T00:46:03+00:00

I am trying to use simple_html_dom to open a file and replace TR attributes.

  • 0

I am trying to use simple_html_dom to open a file and replace TR attributes.

The file contains a table with several rows with no css class or id assigned:

<tr OnMouseOver="changeCouleur(this);" onMouseOut="remetCouleur(this);" OnClick="show('13510.php');">

I use this code to get only the table from the loaded page:

$html = file_get_html('mandats/banque.html');

foreach ($html->find('table') as $node) 
{ echo $node;}

So far the table shows properly, but i was not able to remove OnMouseOver and onMouseOut and to add a css class to modify the row.

I tried with :
$html->find('table,0')->class = 'mndlnk'; with no success

Basically i want to remove all current attributes, keep the link reference and insert a css class to each tr element.

Thanks in advance for your precious suggestions!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:46:04+00:00Added an answer on June 16, 2026 at 12:46 am

    In your question you have

    $html->find('table,0')->class = 'mndlnk';
    

    assuming that code was pasted here correctly it looks like you accidently put the ‘,0’ inside of the quotes it should be

    $html->find('table',0)->class = 'mndlnk';
    

    if that still doesn’t work, you might also want to try

    $html->find('table', 0)->setAttribute('class', 'mndlnk');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the simple_html_dom php class to create a find and replace
I'm trying to use jQuery to insert HTML into a table element. I've been
I am trying to use the 'FileReader' and 'File' APIs that are supported in
I'm trying to use a foreach to save the results to a file but
I'm trying to use simple_html_dom to remove all the spans from a snippet of
http://jsfiddle.net/eE4Y2/2/ I'm trying to use css to create a rounded, folded corner illusion for
I'm trying to use simple html dom to extract elements from a file that
I am trying to use WordToHtmlConverter class to convert a word document in HTML,
Hi i am trying to use simple_html_dom for a text(website) clustering project but i
I am trying to use an XMLHTTPRequest to download an .xml file and add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.