ASP.NET - need to display text instead of images in my forum applcation

Asked By mani on 23-Jan-12 02:36 AM
hi..i am developing forum application..in that i am posting both  some text and images in my editor tool..
after posting i am display in forum list..so when i display that text and image after posting , i need to display some other text instead of that posted image only than i need to mouseover and need to show that image in popup..
so how can i catch that image on page loading from that posted paragraph..????
D Company replied to mani on 23-Jan-12 03:05 AM
Hello Mani,


try this sample

You can have a separate method for setting images via JavaScript.that way the images can be handled by a separate function


<script language="javascript">     
     
function getImage(dataSource, divID)
{      
//create image element      
var img = document.createElement('img');      
//assuming divID has the target div id      
img.onload = function (e)
{        
alert("Loading Image");        
document.getElementById(divID).width = this.width;        
document.getElementById( divID).height = this.height;      
}       
  img.onerror = function (e)
{        
alert("Error processing Image.  Please try again." + e);      
}      
//set the path here      
img.src = dataSource;      
var targetDIV = document.getElementById(divID);      
//clear contents of target div      
if (targetDIV.hasChildNodes()) {        
while (targetDIV.childNodes.length >= 1)
{          
targetDIV.removeChild(targetDIV.firstChild);        
}      
}      
//finally add the image as a child control to the div.      
targetDIV.appendChild(img);    
}  
</script>

and call this by onmouseover="getImage('Image/1.jpg','targetDiv')

Hope this will help you!!

Regards
D
Riley K replied to mani on 23-Jan-12 03:10 AM


You mean picture popup on text mouseover

try something like this 



<a href="http://www.yahoo.com" onMouseover="<img src=images/amenities_1.gif />"; onMouseout="hideddrivetip()">Search Engine</a>

Regards
Jitendra Faye replied to mani on 23-Jan-12 03:48 AM
You can simply use jquery for this-

$(".comment_div").hover(
  function() { $(this).children(".comment_actions").show(); },
  function() { $(this).children(".comment_actions").hide(); }
);


Try this and let me know.