Compartir a través de


Creating DHTML Content for IIS Applications

To create Web pages that are processed dynamically on the client instead of the IIS server, you can add DHTML code to access the Document Object Model (DOM) from HTML pages.

The following simple example shows you how to use the C++ programming language to subdivide an HTML page with <DIV> tags, and set the display style property so that it displays the division when the user clicks a Select button.

<SCRIPT LANGUAGE = "VBScript">  
Sub showit() 
    'This subroutine is called when the user clicks a select button. 
    'It displays text in the hidden DIV. 
    document.all.MyDiv.style.display = "" 
End Sub 

</SCRIPT> 

<DIV ID= "MyDiv" style="display: 'none'" >  
This is some hidden text. 
</DIV> 
<Select id= "Showit" onclick=showit> 

The following example code shows you how to use the VBScript programming language to create a Web page that submits a form when the Submit button is clicked, unless the user has entered "no" in the text box. This code example was taken from the WROX Press book, Professional Active Server Pages - The Subordinate Objects of the Document Object. Please see that topic for information about other DOM objects and how to call them in an HTML page.

<HTML> 
<HEAD> 
<TITLE> Form Submit </TITLE> 
</HEAD 
<BODY> 
<H1> Form Submit </H1> 
<FORM NAME="myForm" ACTION="http://mysite.com/" METHOD="GET"> 
    <INPUT TYPE="TEXT" NAME="txtOne"> 
    <INPUT TYPE="SUBMIT" NAME="sbmTest"> 
</FORM> 
<SCRIPT LANGUAGE="VBScript"> 
Function myForm_onSubmit 
    If Document.myForm.txtOne.Value = "no" then 
        myForm_onSubmit = False 
    Else 
        myForm_onSubmit = True 
    End if 
End Function 
</SCRIPT> 
</BODY> 
</HTML>

See Also

Other Resources

Professional Active Server Pages - The Subordinate Objects of the Document Object

Developing DHTML Applications

The Document Object

DOM Developer's Guide

DOM Reference