/*測試參數數組
aa("33","44","55");
function aa(id)
{
var i, s, numargs = arguments.length;
Response.Write (numargs);
Response.Write (arguments[0]);
}
function ArgTest(){
var i, s, numargs = arguments.length;
s = numargs;
if (numargs < 2)
s += " argument was passed to ArgTest. It was ";
else
s += " arguments were passed to ArgTest. They were " ;
for (i = 0; i < numargs; i++)
{
s += arguments[i] + " ";
}
return(s);
}
*/
int numrows =int.Parse(DropDown1.SelectedItem.Value);
// C# privatevoid Button1_Click(object sender, System.EventArgs e)
{
DataView aDataView = authorData.Tables[0].DefaultView;
foreach( DataRowView aRow in aDataView)
{
TableRow aTableRow =new TableRow();
TableCell aCell =new TableCell();
aCell.Text = aRow["last"].ToString();
aTableRow.Cells.Add(aCell);
Table1.Rows.Add(aTableRow);
} } DataBinder.Eval(Container, "DataItem.ITEM_NO").ToString()
AnchorLink.NavigateUrl ="controls_navigationtarget.aspx?name="+ System.Web.HttpUtility.UrlEncode(Name.Text);
using System;
using System.Globalization;
using System.Threading;
publicclass FormatDate
{
publicstaticvoid Main()
{
DateTime dt = DateTime.Now;
// Set the CurrentCulture property to U.S. English. Thread.CurrentThread.CurrentCulture =new CultureInfo("en-US");
// Display dt, formatted using the ShortDatePattern
// and the CurrentThread.CurrentCulture. Console.WriteLine(dt.ToString("d"));
// Create a CultureInfo object for German in Germany. CultureInfo ci =new CultureInfo("de-DE");
// Display dt, formatted using the ShortDatePattern
// and the CultureInfo object. Console.WriteLine(dt.ToString("d", ci));
} } [C#]
DateTime dt = DateTime.Now;
DateTimeFormatInfo dfi =new DateTimeFormatInfo();
CultureInfo ci =new CultureInfo("de-DE");
// Make up a new custom DateTime pattern, for demonstration. dfi.MonthDayPattern ="MM-MMMM, ddd-dddd";
// Use the DateTimeFormat from the culture associated
// with the current thread. Console.WriteLine( dt.ToString("d") );
Console.WriteLine( dt.ToString("m") );
// Use the DateTimeFormat from the specific culture passed. Console.WriteLine( dt.ToString("d", ci ) );
// Use the settings from the DateTimeFormatInfo object passed. Console.WriteLine( dt.ToString("m", dfi ) );
// Reset the current thread to a different culture. Thread.CurrentThread.CurrentCulture =new CultureInfo("fr-BE");
Console.WriteLine( dt.ToString("d") );
System.DateTime .Now .ToShortDateString()
"2002-9-20" System.DateTime .Now .ToShortTimeString()
"7:45" System.DateTime .Now .ToLongDateString()
"2002年9月20日" System.DateTime .Now .ToLongTimeString()
"7:45:41" if(e.Item.ItemType==ListItemType.Item
|| e.Item.ItemType==ListItemType.AlternatingItem)
{
.
<PUBLIC:PROPERTY NAME="hiliteColor"/> <PUBLIC:ATTACH EVENT="onload" FOR="window" ONEVENT="initColors()"/> <SCRIPT LANGUAGE="JScript"> function initColors()
{
// initialize the property hiliteColor = (hiliteColor ==null) ?"red" : hiliteColor;
} </SCRIPT> function getData(presClass){
var studentNode, studentRef, studentName;
var teachRef = presClass.childNodes.item(1).getAttribute('ref');
var teachNode = xmlid.nodeFromID(teachRef);
classTitle.innerText = presClass.childNodes.item(0).text;
classID.innerText = presClass.getAttribute('id');
teacher.innerText = teachNode.childNodes.item(0).text;
var studentRefs = presClass.childNodes.item(2).childNodes;
var tableStr ="<TABLE>";
for (var i=0;i<presClass.childNodes.item(2).childNodes.length;i++){
studentRef = studentRefs.item(i).getAttribute('ref');
studentNode = xmlid.nodeFromID(studentRef);
studentName = studentNode.childNodes.item(0).text;
tableStr +="<TR><TD><SPAN ID="+ studentRef + " onclick=getStudentInfo()>"+ studentName +"</SPAN></TD></TR>";
} tableStr +="</TABLE>";
studentTable.innerHTML = tableStr;
}
你要想截获Windows的登陆框里的内容,就触及到windows的安全机制。
可以饶过它!!! function FORM1_onsubmit() {
if (document.FORM1.user.value=="")
{
alert("Please Input username");
document.FORM1.user.focus();
returnfalse ;
} if (document.FORM1.password1.value=="")
{
alert("Please input password!!");
document.FORM1.password1.focus();
returnfalse;
} var xh=new ActiveXObject("Microsoft.XMLHTTP");
var uid=document.FORM1.user.value;
var href1="http://lus/exchange/"+uid;
var pass1=document.FORM1.password1.value;
xh.open ("GET",href1,false,uid,pass1);
xh.send("");
if (xh.status==200)
{
window.open (href1);
returntrue;
} else {
document.FORM1.user.focus();
returnfalse;
} } function window_onload() {
window.FORM1.user.focus();
} IIS :Integrated windows authentication
IIS/Exchange:Base Authentication
VB打开文件的四种方法.txt
Balena solution:
code:--------------------------------------------------------------------------------Function FileText (filename$) AsString Dim handle AsInteger handle = FreeFile
Open filename$ For Input As #handle
FileText = Input$(LOF(handle), handle)
Close #handle
End Function -------------------------------------------------------------------------------- Balena second solution
code:--------------------------------------------------------------------------------Function FileText(ByVal filename AsString) AsString Dim handle AsInteger ' ensure that the file exists IfLen(Dir$(filename)) =0Then Err.Raise 53' File not found EndIf ' open in binary mode handle = FreeFile
Open filename$ For Binary As #handle
' read the string and close the file FileText =Space$(LOF(handle))
Get #handle, , FileText
Close #handle
End Function -------------------------------------------------------------------------------- Chirs Eastwood solution
code:--------------------------------------------------------------------------------Dim iFile AsInteger OnErrorResumeNext iFile = FreeFile
GetFileContents =Space(FileLen(FileName))
Open FileName For Binary As #iFile
Get #iFile, , GetFileContents
Close #iFile
' End Function -------------------------------------------------------------------------------- Cakkie solution
code:--------------------------------------------------------------------------------Dim FFile asInteger Dim strFile asstring FFile = FreeFile
Open "yourfile.txt"for input as #FFile
strFile = input(FileLen("yourfile.txt"),FFile)
Close #FFile