|
<%@ Page language="c#" Codebehind="default.aspx.cs" AutoEventWireup="false" Inherits="AjaxDelegate._default" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>AjaxDelegate Sample</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
<script type="text/javascript" src="AjaxDelegate.js"></script>
<script type="text/javascript">
<!--
function Word(term, definition)
{
this.term = term;
this.definition = definition;
}
function getDefinition(term, textareaID, borderStyle, borderWidth, borderColor)
{
if(term != "")
{
var url = "lookupDefinition.aspx?term=" + term
var ajax = new AjaxDelegate(url, setDefinition, textareaID, borderStyle, borderWidth, borderColor);
ajax.Fetch();
}
}
function setDefinition(url, response, textareaID, borderStyle, borderWidth, borderColor)
{
var word = eval(response);
var textarea = document.getElementById(textareaID);
textarea.value = word.definition;
textarea.style.borderStyle = borderStyle;
textarea.style.borderWidth = borderWidth + 'px';
textarea.style.borderColor = borderColor;
}
//-->
</script>
</head>
<body>
<form id="Form1" method="post" runat="server">
Choose a word to see its definition:<br>
<select onchange="getDefinition(this.options[this.selectedIndex].value, 'd1', 'solid', this.selectedIndex, 'red');">
<option></option>
<option value="apple">apple</option>
<option value="cat">cat</option>
<option value="dog">dog</option>
<option value="fish">fish</option>
</select>
<br><br>
<textarea id="d1" rows="5" cols="10"></textarea>
<br><br>
</form>
</body>
</html>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.