
01-11-2007, 00:57
|
|
|
|
ajax,
html ajax.
asp ().
.
- html:
:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
<script type="text/javascript">
function sendComment()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
var url="ajaxtest.asp";
var name = "name=" + encodeURI(document.getElementById('name1').value)
var params = name;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlHttp.send(params);
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.getElementById("comments").innerHTML=xmlHttp.responseText;
}
}
}
</script>
<title> </title>
</head>
<body>
<form dir=rtl style="font-family:arial;color:black;font-size:10pt;">
: <input type="text" id="name1"/><br/><br/>
<input type="button" value="" onclick="sendComment()" />
</form>
<div style="border-style:solid;border-color:white;border-width:1px;width:100%;height:350;" id="comments"> </div>
</body>
</html>
escape() , asp .
encodeURI() .
asp:
:
<%@ language="VBSCRIPT" Codepage = 1255 %>
<%
Response.Charset="windows-1255"
Session.CodePage=1255
%>
<!--#include virtual = "/erezweb2/Adovbs.inc" -->
<%
name = request.form("name")
set all_dataDB = Server.CreateObject("ADODB.Connection")
all_dataDB.Open "DSN=database;"
set comment = Server.CreateObject("ADODB.RecordSet")
comment.Open "comments", all_dataDB, adOpenStatic, adCmdTable
comment.AddNew
comment("Name") = name
comment.Update
comment.Close
set comment = Nothing
all_dataDB.Close
set all_dataDB = Nothing
%>
<font color="black">
Name = <%=name%> <br/>
</font>
Response.Charset="windows-1255" Name html .
html.
.
.
.
.
|