Tryit Editor v1.8

Source Code:
<!DOCTYPE html> <html> <head> <script> function floatRight() { document.getElementById("img1").style.cssFloat="right"; } function floatLeft() { document.getElementById("img1").style.cssFloat="left"; } </script> </head> <body> <img id="img1" src="w3javascript.gif" width="100" height="132"> <p>This is a paragraph.</p> <p>This is another paragraph.</p> <input type="button" onclick="floatRight()" value="Float right"> <input type="button" onclick="floatLeft()" value="Float left"> </body> </html>
Result:
W3Schools.com - Try it yourself