With Php, I want to convert all the links to the Javascript function, for example:
From: to ex> & lt; A href = "URL" & gt; ABC & lt; / A & gt;
$ doc = new DOMDocument (); $ Doctor & gt; LoadHTML ($ HTML); Foreach ($ doc-> getElementsByTagName ('a') as $ elem) {if ($ elem-> hasativity ('href')) {$ elem- & gt; Set attribute ('onclick', 'some function (' .json_encode ($ elem-> getAttribute ('href')) ')'). $ Elem-> RemoveAttribute ('href'); }}
Comments
Post a Comment