<!DOCTYPE html>
<html>
<body>

<object id="myObject" width="250" height="200" data="helloworld.swf" name="obj1"></object>

<p>Click the button to change the name of the object.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
    document.getElementById("myObject").name = "newObjName";
    document.getElementById("demo").innerHTML = "The name of the object was changed from 'obj1' to 'newObjName'";
}
</script>

</body>
</html>