Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Oct 09, 2007 12:58 AM by yjaved
Participant
1113 Points
228 Posts
Oct 08, 2007 04:15 AM|LINK
Hi Guys
please i need urgent help.................. i m .net developer but dont know much about javascripting.........
i m facing this problum of dynamicallly setting the position of a div........
this div i m using as a popup
document.onmousemove = getMouseCoordinates;
{
}
document.getElementById(
document.getElementById("oContextHTML").style.display = 'block';
i tried to set this position even without using "px" but still its not working.............please help
1394 Points
303 Posts
Oct 08, 2007 05:02 AM|LINK
<
</
<!--
document.onmousemove = getCoordinate;
mosY =
Star
13736 Points
3177 Posts
Oct 08, 2007 04:25 PM|LINK
When/how does the showMenu function get called?
Also, your oContextHTML element needs to be absolutely positioned if you want this to work.
Best regards...
Oct 09, 2007 12:58 AM|LINK
thanks josh i set the position absolute and its working perfect..........thanks again
yjaved
Participant
1113 Points
228 Posts
Setting the position of a div
Oct 08, 2007 04:15 AM|LINK
Hi Guys
please i need urgent help.................. i m .net developer but dont know much about javascripting.........
i m facing this problum of dynamicallly setting the position of a div........
this div i m using as a popup
document.onmousemove = getMouseCoordinates;
var MOUSE_X = 0; var MOUSE_Y = 0; function getMouseCoordinates(){
MOUSE_X = event.clientX - document.body.scrollLeft; MOUSE_Y = event.clientY - document.body.scrollTop;}
var oPopup = window.createPopup(); function showMenu(RowID){
document.getElementById("oContextHTML").style.left = MOUSE_X + "px";document.getElementById(
"oContextHTML").style.top = MOUSE_Y + 25 + "px";document.getElementById("oContextHTML").style.display = 'block';
}
i tried to set this position even without using "px" but still its not working.............please help
Mark as ans if got your answer.because it will be used for the readers of the forum
windows_mss
Participant
1394 Points
303 Posts
Re: Setting the position of a div
Oct 08, 2007 05:02 AM|LINK
<
head runat="server"> <title>Set Div Left& Top Dynamically</title></
head><
body> <form id="form1" runat="server"> <div> <script language="JavaScript"><!--
document.onmousemove = getCoordinate;
var mosX = 0 ; var mosY = 0 ; function getCoordinate(e){
mosX = event.clientX + document.body.scrollLeft ;mosY =
event.clientY + document.body.scrollTop; document.title = "(X Co-Ordinate » "+ mosX +") ( "+"Y Co-ordinate » " +mosY+")";document.getElementById(
'dx').innerHTML = "Mouse X ==» "+mosX+"<br>"+"Mouse Y ==» "+mosY; document.getElementById('dX').style.left = mosX;document.getElementById(
'dX').style.top = mosY; return true}
//--> </script> <div id="dX" style=" position:absolute"></div> </div> </form></
body></
html>NJoy Programming...
Blogging @ xploredotnet
JoshStodola
Star
13736 Points
3177 Posts
Re: Setting the position of a div
Oct 08, 2007 04:25 PM|LINK
When/how does the showMenu function get called?
Also, your oContextHTML element needs to be absolutely positioned if you want this to work.
Best regards...
yjaved
Participant
1113 Points
228 Posts
Re: Setting the position of a div
Oct 09, 2007 12:58 AM|LINK
thanks josh i set the position absolute and its working perfect..........thanks again
Mark as ans if got your answer.because it will be used for the readers of the forum