<!DOCTYPE html>
<html>
<body>
<form id="form1">
An Example Form: <input type="text" name="exampleform">
</form>
<object id="myObject" data="helloworld.swf" width="200" height="200" name="obj1" form="form1"></object>
<p>Click the button to display the id of the form the object element belongs to.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myObject").form.id;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>