Link to home
Start Free TrialLog in
Avatar of charmingduck
charmingduck

asked on

one function after another

I want the onmouseover function in action only after the body is clicked on once. How do I do this?
<script type="text/javascript">

var timer_is_on=0;


function show_coords(event)
{
var x=event.clientX;
var y=event.clientY;
document.getElementById("oo").innerHTML= x+" "+y;
}


function doTimer ()
{
	if(!timer_is_on){ timer_is_on=1; show_coords(event);  }
	
	return true;
	
}





</script>

</head>



<body onmousedown="show_coords(event)" onmouseover="return doTimer()">

<p>Click in the document. An alert box will alert the x and y coordinates of the mouse pointer.</p>

<p id="oo"></p>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of mwochnick
mwochnick
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
a couple of things clicking turns it on and off
one correction the hover is on to start with in the code above - need to change line 25 to this to reverse
        if(timer_is_on){