Use an HTML parser. NOT regular expressions. The problem with regular expressions is that they cannot match nested structures. Assuming your regex must match a single <div> and its closing tag, there is no way to correctly match this input:
Tag Archives: div
Print DIV
<script> function go() { var a = window.open(”,”,’width=300,height=300′); a.document.open(“text/html”); a.document.write(document.getElementById(‘foo’).innerHTML); a.document.close(); a.print(); } </script> <div id=”foo”>This is a test</div> <input type=”button” onclick=”go()” value=”Print this Page”>
Make a Div Into a Link
It’s easy to make any div into a link by using a bit of javascript. You can use this technique to make any div “clickable”. For example, you might want your “header” div to link to your home page. Here’s how it’s done. <div onclick=”location.href=’http://www.example.com’;” style=”cursor:pointer;”></div> you can make your header div clickable by using …
Create Left Image ico In H1 Div
HTML Code <div id=”prdleftcol”> <h1>Φωτογραφίες</h1> <h1>Gallery</h1> </div> CSS Code #prdleftcol{ width:260px; float:left; border-right:1px solid #E8EBEC; color:#666666; font-size:11px; } #prdleftcol h1 { background: transparent url(../images/icn_more.gif) 0px 2px no-repeat; padding-left: 17px; padding-bottom: 5px; margin-top: 10px; font-size:14px } Image Download