Friday, May 20, 2011

box_confirm() method

The box_confirm() method displays a box with two buttons, one saying "OK" and one saying "Cancel". There are two parameters that control the result of whether you pressed OK or Cancel, in which you can insert coding into.

Browser support: all
Original TheMadScript Version: 1.0.0
Newer version: Version 2.0.0

Syntax: box_confirm(value,ok,cancel)

Any parameters that you don't need can be left blank (like this: "").

The following syntax below creates a confirmation box that says, "Press a button.", and returns an answer depending on which button you press. The result text will be an alert box telling you which button you pressed.

box_confirm("Press a button.","box_alert('You pressed OK.')","box_alert('You pressed Cancel.')");

box_alert() method

The box_alert() method creates a popup box with a button that gives you the option to close the box. You can use this as a box to alert someone when an action is not allowed, or for another reason to tell someone something. It can also be used as a result for form validation messages.

Browser support: all
TheMadScript Version: 1.0.0

Syntax: box_alert(message);

The following syntax below creates an alert box that says, "Hello, there!"

box_alert("Hello, there!");

What you need

You should know the following languages before studying TheMadScript: HTML and JavaScript.

Since TheMadScript isn't an actual scripting language, there is a JavaScript file located at my website called "themadscript.js". To add it to your website, use this coding:

<script type="text/javascript" src="http://www.themadcomputer.com/themadscript.js"></script>

Then, you can add any of the methods from either the "head" section of your page or "body" section inside a separate "script" element. You can combine JavaScript with TheMadScript, since TheMadScript is JavaScript-based and is contained inside the "script" element. You'll want to use JavaScript functions in some cases. This is a good example of a page that contains TheMadScript:

<html>
<head>
<script type="text/javascript" src="http://www.themadcomputer.com/themadscript.js"></script>
<script type="text/javascript">
JavaScript/TheMadScript coding
</script>
</head>
<body>
Some coding
<button onclick="TheMadScript coding here">Click Here</button>
Some more coding
</body>
</html>

Do you understand now what you'll be needing? If you do, you can look at the reference for all of the methods, even the deprecated and obsolete ones.