Re: [TECHS] Sample Scripting Technique with Testing Procedures

Becky_Gibson@notesdev.ibm.com wrote:

> I took an action item to propose a scripting technique and procedures for 
> testing it.   

> The idea is to show a technique to allow 
> the user to turn off non-essential interruptions such as those created via 
> the JavaScript alert() function.   

> <script type="text/javascript">
> var bDoAlerts = true;  // global variable which specifies whether to display alerts or not
> 
> /* function to disable alerts.  Called from onclick event on button element in the page */
> function disableAlerts() {
> 	bDoAlerts = false;
> 
> }
> 
> /* wrapper function for displaying alerts.  Checks the value of bDoAlerts
>  *and only calls the alert() function when bDoAlerts is true.
>  */
> function {
   ^^^^^^^^^^
This is not syntactically correct and gives a syntax error. You would 
need () after the function keyword but it rather looks as if all you 
want in the script is the following lines with the function declaration 
for doAlert

> function doAlert(aMessage) {
> 	if (bDoAlerts) {
> 		alert(aMessage);
> 	}
> }

and that "function {" needs to be removed.


-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/

Received on Thursday, 11 August 2005 12:10:29 UTC