[Resolved] getElementById problems...
Edit: This is Fixed
Hey guys,
I've got some php/javascript that I'm trying to use to update some content on a page.
Here's my php function which in turn echoes out the javascript functions I'm working with:
Here's the code that I'm using that I want updated:
Any ideas why the text is not being updated?
Thanks,
David
This is fixed now... I ended up using 1 function instead of two.
Edit: This is Fixed
Hey guys,
I've got some php/javascript that I'm trying to use to update some content on a page.
Here's my php function which in turn echoes out the javascript functions I'm working with:
Code:
function Javascript_Function_ChangeSearchByUserOwner() {
echo "<script language=\"javascript\">
function ChangeSearchByUserOwner(selectbox) {
var username = selectbox.options[selectbox.selectedIndex].value;
document.forms[0].SearchOwnerName.value = username;
document.getElementById('SearchOwnerName').innerHTML = 'Submitted by: ' + username;
}
function ChangeOwner(selectbox) {
var username = selectbox.options[selectbox.selectedIndex].value;
document.forms[0].ownerName.value = username;
document.getElementById('ownerName').innerHTML = 'Submitted by: ' + username;
}
</script>";
}
Here's the code that I'm using that I want updated:
Code:
<?PHP echo "<input type=hidden name=ownerName value='";
$ownerName = next($topdata);
echo $ownerName."'><span id=ownerName>Submitted by: ".$ownerName."</span>
// And Then later in the code....
<div style='width:300px;text-align:center'>
<table width=100%>
<tr>
<td width=100%>
<div style='float:left;width:130px;text-align:left'>
<form name=usersearchform target=hiddenframe action=usersearch.php method=post>
<input type=textbox size=20 name=search id=search> <input type=submit value="Search">
<br />
<select name=userlist id=userlist size=8 width=50px> </select>
</form>
</div>
<div style='float:right;width:130px;text-align:center;font-size:14px;color:white;background-color:#5577bb'>
<form name=holocaust>
<?PHP echo "<span id=SearchOwnerName>Submitted by: ".$ownerName."</span>";?>
</form>
</div>
</td>
</tr>
<tr>
<td align="center">
<input type=button value="Select User" onClick="ChangeSearchByUserOwner(document.usersearchform.userlist)"> <input type=button value="Close Window" onClick="HideDiv('usersearch')">
</td>
</tr>
</table>
</div>
Any ideas why the text is not being updated?
Thanks,
David
This is fixed now... I ended up using 1 function instead of two.
Last edited:








