Dreamweaver Behavior - Alert


Text Box:

  • The code for an Alert Box is:

 


Text Box:

  • You can add an event such as OnClick to trigger the Alert from a text link or a form button or an image.

Text Box: <INPUT TYPE = Button VALUE = "Click" OnClick = "alert('Your text goes here')">

  • Here is the Alert Box code added to links:

Text Box: <a href="#" onClick="alert('Do it again!');">Click me!</a><br>
<a href="#" onMouseOver="alert('Ah… just the right place!');"> Place cursor  here!</a><br>

 

     

  • Select the text you want to make into a link.  Type # in the Properties Link box
  • This will stop the browser trying to open a new window.

  • Deselect the text then select again.  This is to make sure that the behavior is not linked to the whole page.
  •   
  • Find where the Behaviors are in your version of Dreamweaver and click the + to add one.
  • Choose Call JavaScript
  •      
  • Type in the code for an alert as shown: 
  •     
  • You do not use quote marks this time as there are quote marks around the function MM_callJS that is called in the code that Dreamweaver generates.
  • <a href="#" onClick="MM_callJS('alert(\'Your text goes here\') ')">Link</a>
  • Make an HTML page that has links with events and a form with a range of suitable responses using JavaScript. Try the OnMouseOver event as well as the OnClick



  • © J. K. Phillips
    Current URL: