mouse over event

error in execution

Page 1 of 1

6 Replies - 10578 Views - Last Post: 20 October 2009 - 05:23 AM Rate Topic: -----

#1 ramesh866  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 91
  • Joined: 03-October 09

mouse over event

Posted 19 October 2009 - 10:36 AM

i have an text box when the mouse is moved over it, the mouse over event should be called and display some text in a label. so i have typed the code below
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<script type="text/javascript">
function onmouseover()
{
var text="event";
document.getElementById("Label1").innerHTML=text;
}
</script>
	<title>Untitled Page</title>
</head>
<body>
	<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>&nbsp;<form id="form1" runat="server">
	<input type="text" id="TextBox2" onmouseover="onmouseover();" />
	<div>
		&nbsp;</div>
	</form>
</body>
</html>



but when executed and when the mouse is moved over the text box an error message is getting displayed as " stack overflow at line23".. whats wrong is the code.

Is This A Good Question/Topic? 0
  • +

Replies To: mouse over event

#2 MacAnimeGirl  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 282
  • Joined: 30-September 08

Re: mouse over event

Posted 19 October 2009 - 01:52 PM

Try changing the name of your event to something along the lines of displaytext.

I believe onmouseover is reserved.

This post has been edited by MacAnimeGirl: 19 October 2009 - 01:52 PM

Was This Post Helpful? 1
  • +
  • -

#3 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1525
  • View blog
  • Posts: 5,961
  • Joined: 21-March 08

Re: mouse over event

Posted 19 October 2009 - 02:02 PM

this works perfectly fine for me...

<head runat="server">
    <title></title>
    <link id="theme1" href="theme1.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
        function LabelHover() {
            var text = "event";
            document.getElementById("Label1").innerHTML = text;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="Label1" runat="server" Text="Hello" ForeColor="White" onmouseover="LabelHover()"></asp:Label>
    </div>
    </form>
</body>


Was This Post Helpful? 1
  • +
  • -

#4 MacAnimeGirl  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 282
  • Joined: 30-September 08

Re: mouse over event

Posted 19 October 2009 - 02:10 PM

View Posteclipsed4utoo, on 19 Oct, 2009 - 01:02 PM, said:

this works perfectly fine for me...

<head runat="server">
    <title></title>
    <link id="theme1" href="theme1.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
        function LabelHover() {
            var text = "event";
            document.getElementById("Label1").innerHTML = text;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="Label1" runat="server" Text="Hello" ForeColor="White" onmouseover="LabelHover()"></asp:Label>
    </div>
    </form>
</body>




But you're using LabelHover() as the method name. If you look at the code they're using onmouseover as the method name and I believe that's where the error is kicking in at.
Was This Post Helpful? 0
  • +
  • -

#5 W3bDev  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 42
  • View blog
  • Posts: 379
  • Joined: 15-March 09

Re: mouse over event

Posted 19 October 2009 - 04:10 PM

View PostMacAnimeGirl, on 19 Oct, 2009 - 01:10 PM, said:

View Posteclipsed4utoo, on 19 Oct, 2009 - 01:02 PM, said:

this works perfectly fine for me...

<head runat="server">
    <title></title>
    <link id="theme1" href="theme1.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
        function LabelHover() {
            var text = "event";
            document.getElementById("Label1").innerHTML = text;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="Label1" runat="server" Text="Hello" ForeColor="White" onmouseover="LabelHover()"></asp:Label>
    </div>
    </form>
</body>




But you're using LabelHover() as the method name. If you look at the code they're using onmouseover as the method name and I believe that's where the error is kicking in at.



You're right, its reserved.
Was This Post Helpful? 1
  • +
  • -

#6 ramesh866  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 91
  • Joined: 03-October 09

Re: mouse over event

Posted 19 October 2009 - 11:26 PM

yup, you guys were right.it worked.
thanks brothers
Was This Post Helpful? 0
  • +
  • -

#7 MacAnimeGirl  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 282
  • Joined: 30-September 08

Re: mouse over event

Posted 20 October 2009 - 05:23 AM

I'm glad I could help!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1