...

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



NewbNeedHelp
02-07-2007, 02: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"
}
</script>
<div id="profiles">
<dl>
<dt>Officers</dt>
<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>
<dd>Peasant1</dd>
<dd>peasant2</dd>
<dd>peasant3</dd>
<dd>peasant4</dd>
</dl>
<object name="window" type="text/html" data="roster/Rosterblank.htm">
Error!
</object>

david_kw
02-07-2007, 06: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;

david_kw



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum