View Full Version : Using onclick to change data in an object

02-07-2007, 01:08 AM
I was given the following code in hopes that it would replace the 'data' attribute in an object. I've toyed with it and can't seem to get it to work. I was wondering if anyone here knew how to fix it. The link to the page is http://activities.fit.edu/aiaa/Test/FITUltimate/roster.htm

<script type="text/javascript">
function changeData(filePath)
document.getElementById("window").data = "filePath"
<div id="profiles">
<dd onclick="changeData('roster/theman.htm')">President: The man</dd>
<dd>Vice President: the other man</dd>
<dd>Treasurer: other other man</dd>
<dd>Captain: the other</dd>
<dd>Coach: the other other</dd>
<dt>Average Beings</dt>
<object name="window" type="text/html" data="roster/Rosterblank.htm">

02-07-2007, 05:32 AM
One place to start is to change the <object> tag and add id="window" since you are using the getElementById() function.

Another is to get rid of the quotes around filePath so it puts in the parameter instead of a string named "filePath".

document.getElementById("window").data = filePath;