<script> function myOnMouseOver() { alert('Hello, world!'); } </script> <body> <iframe id="frame1" onMouseOver="myOnMouseOver()" src="frame.html"></iframe> <iframe id="frame2" onMouseOver="myOnMouseOver()" src="frame2.html"></iframe> </body>