Web Hosting Directory | Web Hosting Resources | Webmaster Resources | Domain Tools | Search Engine Marketing | Forums
  Signup
Today: 1,030   Yesterday: 1,235   Max: 1,872   Total: 482,007   Current Users : 16 (Member 0) 
DOMAIN TOOLS

WEBMASTER TOOLS

RELATED ARTICLES

SUBMIT AN ARTICLE

Write for us and get publicity, link to your website, and best of all get paid. Please visit our writers page for details.


LINK TO US

Link to us and earn points for each visitor you bring to us. Please visit our link partner page for details.

 

Attributes for <SCRIPT ...>
FOR = "object ID"
EVENT = event name

Usage Recommendation
don't use it thumbs down

FOR and EVENT, which are MSIE extensions, are used together to create a script that operates as an event handler for an object. For example, the following script sets itself as the onsubmit() event handler for the object whose ID is myform:

<SCRIPT TYPE="text/javascript" FOR="myform" EVENT="onsubmit()">
<!--
var response=confirm("are you sure you want to submit?");
return response;
//-->
</SCRIPT>

The script is then applied to a form by setting the form's ID to myform:

<FORM ACTION="../cgi-bin/mycgi.pl" ID="myform">
name: <INPUT NAME="realname"><BR>
email: <INPUT NAME="email"><BR>
<INPUT TYPE=SUBMIT VALUE="join">
</FORM>

which (in MSIE) gives us this form:

name:
email:

This technique for setting an event handler isn't any easier than the traditional method which is also much more universal. Any object that has an event can have that event set with the appropriate attribute. For example, to set our form to check if the user really wants to submit we can use a script function and the onSubmit attribute. The script would look like this, creating a function called submitconfirm():

<SCRIPT TYPE="text/javascript">
<!--
function submitconfirm()
{
var response=confirm("are you sure you want to submit?");
return response;
}
//-->
</SCRIPT>

The form would call submitconfirm() in onSubmit like this:

<FORM 
    ACTION="../cgi-bin/mycgi.pl" 
    onSubmit="return submitconfirm()">
name: <INPUT NAME="realname"><BR>
email: <INPUT NAME="email"><BR>
<INPUT TYPE=SUBMIT VALUE="join">
</FORM>

which gives us this form (try submitting it):

name:
email:



Copyright 1997-2002 Idocs, Inc. Written by Miko Sullivan.

 
 
 
What is your major source of website traffic?
 
 
 
 
 
 

ADVERTISEMENT

 
Cheap Web HostingBudget Web HostingEcommerce Web Hosting
Link to UsLink ExchangeAdvertisePrivacy PolicyTerms Of ServiceAbout UsContact UsSitemap
Copyright © 2006 - 2008 Broadband Media, Inc. All rights reserved.