Landfill of wisdom

Dumping ground for small tips and big papers

Browsing Posts tagged HTML

A common issue — setting the onSubmit event handler of a form with JavaScript. I mean, it’s easy enough to set it with <form id=’theForm’ onsubmit=”return confirm(‘Really submit?’);”> but here is how to do it with JavaScript <script type=’text/javascript’> document.getElementyById(‘theForm’).onSubmit = function() { return confirm(‘Really submit?’); }; </script>

I have had to write an HTML parser a few times already and I’ve always used HTML::Parser. Because it’s simple and because I never bothered to do it anohter way. I always wanted to ideally do some parsing with XPath because that way I can easily find what I need with one or two queries. […]