Jump to content

Alert box with onmouseover


Fire Dragon

Recommended Posts

I tried make character,what speaks when you bring cursor over it.I got it worked before,but now it won't work.And with all this,I have another problem.When you bring mouse over character,message appears,but as long that mouse is over character,message pops again and again.I tired handle this problem with break; ,but it won't work,or it ruined whole character's speak.What is wrong?Here is my character's code:

<img src="http://i43.photobucket.com/albums/e366/kyogre_atlas/Zelda%20spritet/npc_wizard.gif"onmouseover="wizard()" style="position:absolute;top:200px;left:0px">

And here is my character's text box:

<script type="text/javascript">function wizard(){alert("Blaa,blaa, blaa,blaa,blaa,blaa,blaa,blaa,blaa," + '\n' + "blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa," + '\n' + "blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa, " + '\n' + "blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,blaa,")}</script>

Link to comment
Share on other sites

It worked perfectly for me when I shortened the code to this:

<head><script type="text/javascript">function wizard(){alert("Blaa,blaa, blaa,blaa,blaa,blaa,blaa,blaa,blaa,")}</script></head><img src="http://i43.photobucket.com/albums/e366/kyogre_atlas/Zelda%20spritet/npc_wizard.gif" onmouseover="wizard()">

By the way, I only removed the extra style attributes for aesthetic purposes. :)

Link to comment
Share on other sites

Chocolate570's example worked fine for me :) An alternative to an alert box could be a floating divcreate a floating div that appears when the mouse is over the character (onmousemove) and disappears when you move off the character (onmouseout), the message can go inside the div. :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...