ZeroShade Posted August 13, 2007 Share Posted August 13, 2007 I'm having a problem calling a second function. Its not putting the text in the div... it instead just says "[object]". Any ideas? function changeDescription(desc) { if (xmlHttpRequestObject) { var descObj = document.getElementById("objDesc"); xmlHttpRequestObject.open("GET", desc); xmlHttpRequestObject.onreadystatechange = function() { if(xmlHttpRequestObject.readyState == 4 && xmlHttpRequestObject.status == 200) { // The state is complete and the status is successful. } } descObj.innerHTML = objDesc; } else { alert("Your browser does not support AJAX!"); window.location="Default.aspx"; } } </script> <div style="background-image:url('img/Header.png'); background-repeat:no-repeat; height:50px; font-family:Verdana; text-align:center; font-size:medium; font-weight:bold; "> <br />Photos </div> <center> <asp:Panel ID="ImageViewPanel" runat="server" Height="400px" Width="600px" BorderColor="white" BorderWidth="5px"> <asp:FormView ID="ImageFormView" runat="server" DataSourceID="ImageObjectDataSource" DataKeyNames="ImageId"> <ItemTemplate> <img src='album/<%# Eval("ImageName") %>' id="ViewImage" alt="" height="400px" width="600px" /> <div id="objDesc"><%# Eval("ImageDescription") %></div> </ItemTemplate> Link to comment Share on other sites More sharing options...
justsomeguy Posted August 13, 2007 Share Posted August 13, 2007 descObj.innerHTML = objDesc;What is objDesc? Link to comment Share on other sites More sharing options...
ZeroShade Posted August 14, 2007 Author Share Posted August 14, 2007 objDesc is simpy the id for a div tag inside the item template. <div id="objDesc"><%# Eval("ImageDescription") %></div> Link to comment Share on other sites More sharing options...
Synook Posted August 15, 2007 Share Posted August 15, 2007 Well then you will have to reference its content using the innerHTML property. descObj.innerHTML = document.getElementById('objDesc').innerHTML; Link to comment Share on other sites More sharing options...
ZeroShade Posted August 15, 2007 Author Share Posted August 15, 2007 Looking at your example made me realize... the value I'm passing through... isn't being used at all! I must of be tired... now it works. Before I had descObj.innerHTML = an id and not the value i was passing through. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.