Update DIV on Image Rollover

Sunday, March 29, 2015 Unknown 0 Comments

I wanted to do a simple task.. Roll over an image, and have a DIV.innerhtml updated.

My problem was that an image doesn't have any mouse rollover events server side.

1. javascript client side (the aspx file)

function img9over(){
var str = document.getElementById('txt1').value;
var ni = document.getElementById('divinfo');
ni.innerHTML = str;
}

function img9out(){
var ni = document.getElementById('divinfo');
ni.innerHTML = "";
}


2.server side code.

ClientScript.RegisterHiddenField("txt1", "SOMETHING FOR THE DIV")

3. And the Img tag needed the events
img onmouseover=""img9over()"" onmouseout=""img9out()"" src="someimage"

4. The DIV with id="divinfo".

I know it's all basic stuff.. I got stuck trying to get the hidden field.. if you manually add the txt box, it doesn't have the hidden option. and txt1.visible=false doesn't right the txt1 box a runtime, meaning it's not hidden... it's just not there.

0 comments :

Powered by Blogger.