SHARE
Facebook X Pinterest WhatsApp

HTML Goodies: Script Tip: Week 7

Written By
thumbnail
Joe Burns
Joe Burns
Jan 4, 2005

Hey, Tipmeisters…

This week we tear a little further into this fine script in an attempt to better understand it.







<SCRIPT LANGUAGE=”javascript”>


function JemWebCONFIRM()

{if (!confirm (“YOUR MESSAGE GOES HERE”))
history.go(-1);return ” “}


</SCRIPT>






Now, last time around we talked about the function, JemWebCONFIRM(), and what it did. This week we’re going to talk about those parentheses that always seem to follow.

Believe it or not, those parentheses actually have a name. They’re called an “instance.” Here’s a textbook-type definition:

The instance of a command is contained in parentheses immediately following the command. The instance contains information about what an object is to do or how a method is to be carried out.

Notice that this script has a few sets of parentheses. One set follows right after the function, the second surrounds the If statement, and the third surrounds the confirm command.

I can always keep my parentheses straight if I think of them like mathematical statements: Everything inside the parentheses gets done first. That means every open parenthesis needs a closer to go along with it.

But why are some parentheses empty, like the function, and others full of commands, like the confirm? It’s because of what they do. Remember, the function is really a method. The method is carried out through a long series of commands. Remember that from last week? If the parentheses are empty, then the script looks for commands included inside of fancy parentheses { }. Those parentheses that have commands inside, run them.

Later in the Tips, we’ll get into actually adding a name into the function parentheses so that you make it act upon a specific part of the page. But that’s later…

Next Week: The Confirm Statement



     Do YOU have a Script Tip you’d like to share? How about suggesting a Script Tip to write about? I’d love to hear it. Write me at: jburns@htmlgoodies.com.


Learn to write your own JavaScripts with the
JavaScript Goodies!



You can find many other uses for JavaScript
on your Web pages here!

Recommended for you...

The Revolutionary ES6 Rest and Spread Operators
Rob Gravelle
Aug 23, 2022
Ahead of Time (AOT) Compilation in Angular
Tariq Siddiqui
Aug 16, 2022
Converting a JavaScript Object to a String
Rob Gravelle
Aug 14, 2022
Understanding Primitive Type Coercion in JavaScript
Rob Gravelle
Jul 28, 2022
HTML Goodies Logo

The original home of HTML tutorials. HTMLGoodies is a website dedicated to publishing tutorials that cover every aspect of being a web developer. We cover programming and web development tutorials on languages and technologies such as HTML, JavaScript, and CSS. In addition, our articles cover web frameworks like Angular and React.JS, as well as popular Content Management Systems (CMS) that include WordPress, Drupal, and Joomla. Website development platforms like Shopify, Squarespace, and Wix are also featured. Topics related to solid web design and Internet Marketing also find a home on HTMLGoodies, as we discuss UX/UI Design, Search Engine Optimization (SEO), and web dev best practices.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.