| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| NamePros Regular | [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: 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>";
}
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>
Thanks, David This is fixed now... I ended up using 1 function instead of two.
__________________ Smooth Stone Services Affordable Web Hosting Solutions Starting at only $4.95/month, IT Consulting and Technical Support Hunt Sources - Hunting Resources Online Last edited by Rudy; 01-04-2007 at 06:29 AM. |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |