C# 操作文件夹、文件
Form
namespace FileProperties
{
public partial class Form1 : Form
{
private string currentFolderPath; public Form1()
{
InitializeComponent();
} protected void ClearAllFields()
{
listBoxFolders.Items.Clear();
listBoxFiles.Items.Clear();
textBoxFolder.Text = "";
textBoxFolder.Text = "";
textBoxFileName.Text = "";
textBoxCreationTime.Text = "";
textBoxLastAccessTime.Text = "";
textBoxLastWriteTime.Text = "";
textBoxFileSize.Text = "";
} protected void DisplayFileInfo(string fileFullName)
{
FileInfo theFile = new FileInfo(fileFullName);
if (!theFile.Exists)
throw new FileNotFoundException("File not found: " + fileFullName);
textBoxFileName.Text = theFile.Name;
textBoxCreationTime.Text = theFile.CreationTime.ToLongTimeString();
textBoxLastAccessTime.Text = theFile.LastAccessTime.ToLongDateString();
textBoxLastWriteTime.Text = theFile.LastWriteTime.ToLongDateString();
textBoxFileSize.Text = theFile.Length + " bytes"; // enable move, copy, delete buttons
textBoxNewPath.Text = theFile.FullName;
textBoxNewPath.Enabled = true;
buttonCopyTo.Enabled = true;
buttonDelete.Enabled = true;
buttonMoveTo.Enabled = true;
} protected void DisplayFolderList(string folderFullName)
{
DirectoryInfo theFolder = new DirectoryInfo(folderFullName);
if (!theFolder.Exists)
throw new DirectoryNotFoundException("Folder not found: "
+ folderFullName);
ClearAllFields();
DisableMoveFeatures();
textBoxFolder.Text = theFolder.FullName;
currentFolderPath = theFolder.FullName; // list all subfolders in folder foreach (DirectoryInfo nextFolder in theFolder.GetDirectories())
listBoxFolders.Items.Add(nextFolder.Name); // list all files in folder foreach (FileInfo nextFile in theFolder.GetFiles())
listBoxFiles.Items.Add(nextFile.Name);
} protected void OnDisplayButtonClick(object sender, EventArgs e)
{
try
{
string folderPath = textBoxInput.Text;
DirectoryInfo theFolder = new DirectoryInfo(folderPath);
if (theFolder.Exists)
{
DisplayFolderList(theFolder.FullName);
return;
}
FileInfo theFile = new FileInfo(folderPath);
if (theFile.Exists)
{
DisplayFolderList(theFile.Directory.FullName);
int index = listBoxFiles.Items.IndexOf(theFile.Name);
listBoxFiles.SetSelected(index, true);
return;
}
throw new FileNotFoundException("There is no file or folder with "
+ "this name: " + textBoxInput.Text);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} void DisableMoveFeatures()
{
textBoxNewPath.Text = "";
textBoxNewPath.Enabled = false;
buttonCopyTo.Enabled = false;
buttonDelete.Enabled = false;
buttonMoveTo.Enabled = false;
} protected void OnListBoxFilesSelected(object sender, EventArgs e)
{
try
{
string selectedString = listBoxFiles.SelectedItem.ToString();
string fullFileName = Path.Combine(currentFolderPath, selectedString);
DisplayFileInfo(fullFileName);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} protected void OnListBoxFoldersSelected(object sender, EventArgs e)
{
try
{
string selectedString = listBoxFolders.SelectedItem.ToString();
string fullPathName = Path.Combine(currentFolderPath, selectedString);
DisplayFolderList(fullPathName);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} protected void OnUpButtonClick(object sender, EventArgs e)
{
try
{
string folderPath = new FileInfo(currentFolderPath).DirectoryName;
DisplayFolderList(folderPath);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} protected void OnDeleteButtonClick(object sender, EventArgs e)
{
try
{
string filePath = Path.Combine(currentFolderPath,
textBoxFileName.Text);
string query = "Really delete the file\n" + filePath + "?";
if (MessageBox.Show(query,
"Delete File?", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
File.Delete(filePath);
DisplayFolderList(currentFolderPath);
}
}
catch (Exception ex)
{
MessageBox.Show("Unable to delete file. The following exception"
+ " occurred:\n" + ex.Message, "Failed");
}
} protected void OnMoveButtonClick(object sender, EventArgs e)
{
try
{
string filePath = Path.Combine(currentFolderPath,
textBoxFileName.Text);
string query = "Really move the file\n" + filePath + "\nto "
+ textBoxNewPath.Text + "?";
if (MessageBox.Show(query,
"Move File?", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
File.Move(filePath, textBoxNewPath.Text);
DisplayFolderList(currentFolderPath);
}
}
catch (Exception ex)
{
MessageBox.Show("Unable to move file. The following exception"
+ " occurred:\n" + ex.Message, "Failed");
}
}
protected void OnCopyButtonClick(object sender, EventArgs e)
{
try
{
string filePath = Path.Combine(currentFolderPath,
textBoxFileName.Text);
string query = "Really copy the file\n" + filePath + "\nto "
+ textBoxNewPath.Text + "?";
if (MessageBox.Show(query,
"Copy File?", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
File.Copy(filePath, textBoxNewPath.Text);
DisplayFolderList(currentFolderPath);
}
}
catch (Exception ex)
{
MessageBox.Show("Unable to copy file. The following exception"
+ " occurred:\n" + ex.Message, "Failed");
}
}
}
}
Designer
namespace FileProperties
{ partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null; /// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
} #region Windows Form Designer generated code /// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.label14 = new System.Windows.Forms.Label();
this.textBoxNewPath = new System.Windows.Forms.TextBox();
this.buttonDelete = new System.Windows.Forms.Button();
this.buttonCopyTo = new System.Windows.Forms.Button();
this.buttonMoveTo = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.textBoxLastAccessTime = new System.Windows.Forms.TextBox();
this.textBoxLastWriteTime = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.textBoxCreationTime = new System.Windows.Forms.TextBox();
this.textBoxFileSize = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.buttonDisplay = new System.Windows.Forms.Button();
this.textBoxFolder = new System.Windows.Forms.TextBox();
this.buttonUp = new System.Windows.Forms.Button();
this.textBoxInput = new System.Windows.Forms.TextBox();
this.textBoxFileName = new System.Windows.Forms.TextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.listBoxFiles = new System.Windows.Forms.ListBox();
this.listBoxFolders = new System.Windows.Forms.ListBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox5.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupBox5
//
this.groupBox5.Controls.Add(this.label14);
this.groupBox5.Controls.Add(this.textBoxNewPath);
this.groupBox5.Controls.Add(this.buttonDelete);
this.groupBox5.Controls.Add(this.buttonCopyTo);
this.groupBox5.Controls.Add(this.buttonMoveTo);
this.groupBox5.Location = new System.Drawing.Point(, );
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(, );
this.groupBox5.TabIndex = ;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Move, Delete or Copy File";
//
// label14
//
this.label14.Location = new System.Drawing.Point(, );
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(, );
this.label14.TabIndex = ;
this.label14.Text = "New Location";
//
// textBoxNewPath
//
this.textBoxNewPath.Location = new System.Drawing.Point(, );
this.textBoxNewPath.Name = "textBoxNewPath";
this.textBoxNewPath.Size = new System.Drawing.Size(, );
this.textBoxNewPath.TabIndex = ;
//
// buttonDelete
//
this.buttonDelete.Location = new System.Drawing.Point(, );
this.buttonDelete.Name = "buttonDelete";
this.buttonDelete.Size = new System.Drawing.Size(, );
this.buttonDelete.TabIndex = ;
this.buttonDelete.Text = "Delete";
this.buttonDelete.Click += new System.EventHandler(this.OnDeleteButtonClick);
//
// buttonCopyTo
//
this.buttonCopyTo.Location = new System.Drawing.Point(, );
this.buttonCopyTo.Name = "buttonCopyTo";
this.buttonCopyTo.Size = new System.Drawing.Size(, );
this.buttonCopyTo.TabIndex = ;
this.buttonCopyTo.Text = "Copy To";
this.buttonCopyTo.Click += new System.EventHandler(this.OnCopyButtonClick);
//
// buttonMoveTo
//
this.buttonMoveTo.Location = new System.Drawing.Point(, );
this.buttonMoveTo.Name = "buttonMoveTo";
this.buttonMoveTo.Size = new System.Drawing.Size(, );
this.buttonMoveTo.TabIndex = ;
this.buttonMoveTo.Text = "Move To";
this.buttonMoveTo.Click += new System.EventHandler(this.OnMoveButtonClick);
//
// label3
//
this.label3.Location = new System.Drawing.Point(, );
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(, );
this.label3.TabIndex = ;
this.label3.Text = "Creation time";
//
// textBoxLastAccessTime
//
this.textBoxLastAccessTime.Enabled = false;
this.textBoxLastAccessTime.Location = new System.Drawing.Point(, );
this.textBoxLastAccessTime.Name = "textBoxLastAccessTime";
this.textBoxLastAccessTime.Size = new System.Drawing.Size(, );
this.textBoxLastAccessTime.TabIndex = ;
//
// textBoxLastWriteTime
//
this.textBoxLastWriteTime.Enabled = false;
this.textBoxLastWriteTime.Location = new System.Drawing.Point(, );
this.textBoxLastWriteTime.Name = "textBoxLastWriteTime";
this.textBoxLastWriteTime.Size = new System.Drawing.Size(, );
this.textBoxLastWriteTime.TabIndex = ;
//
// label6
//
this.label6.Location = new System.Drawing.Point(, );
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(, );
this.label6.TabIndex = ;
this.label6.Text = "Last modification time";
//
// label1
//
this.label1.Location = new System.Drawing.Point(, );
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(, );
this.label1.TabIndex = ;
this.label1.Text = "Enter name of folder to be examined and click Display";
//
// label5
//
this.label5.Location = new System.Drawing.Point(, );
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(, );
this.label5.TabIndex = ;
this.label5.Text = "Last access time";
//
// textBoxCreationTime
//
this.textBoxCreationTime.Enabled = false;
this.textBoxCreationTime.Location = new System.Drawing.Point(, );
this.textBoxCreationTime.Name = "textBoxCreationTime";
this.textBoxCreationTime.Size = new System.Drawing.Size(, );
this.textBoxCreationTime.TabIndex = ;
//
// textBoxFileSize
//
this.textBoxFileSize.Enabled = false;
this.textBoxFileSize.Location = new System.Drawing.Point(, );
this.textBoxFileSize.Name = "textBoxFileSize";
this.textBoxFileSize.Size = new System.Drawing.Size(, );
this.textBoxFileSize.TabIndex = ;
//
// label7
//
this.label7.Location = new System.Drawing.Point(, );
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(, );
this.label7.TabIndex = ;
this.label7.Text = "File Size";
//
// label8
//
this.label8.Location = new System.Drawing.Point(, );
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(, );
this.label8.TabIndex = ;
this.label8.Text = "Folders";
//
// label2
//
this.label2.Location = new System.Drawing.Point(, );
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(, );
this.label2.TabIndex = ;
this.label2.Text = "Files";
//
// label4
//
this.label4.Location = new System.Drawing.Point(, );
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(, );
this.label4.TabIndex = ;
this.label4.Text = "File name";
//
// buttonDisplay
//
this.buttonDisplay.Location = new System.Drawing.Point(, );
this.buttonDisplay.Name = "buttonDisplay";
this.buttonDisplay.Size = new System.Drawing.Size(, );
this.buttonDisplay.TabIndex = ;
this.buttonDisplay.Text = "Display";
this.buttonDisplay.Click += new System.EventHandler(this.OnDisplayButtonClick);
//
// textBoxFolder
//
this.textBoxFolder.Enabled = false;
this.textBoxFolder.Location = new System.Drawing.Point(, );
this.textBoxFolder.Name = "textBoxFolder";
this.textBoxFolder.Size = new System.Drawing.Size(, );
this.textBoxFolder.TabIndex = ;
//
// buttonUp
//
this.buttonUp.Location = new System.Drawing.Point(, );
this.buttonUp.Name = "buttonUp";
this.buttonUp.Size = new System.Drawing.Size(, );
this.buttonUp.TabIndex = ;
this.buttonUp.Text = "Up";
this.buttonUp.Click += new System.EventHandler(this.OnUpButtonClick);
//
// textBoxInput
//
this.textBoxInput.Location = new System.Drawing.Point(, );
this.textBoxInput.Name = "textBoxInput";
this.textBoxInput.Size = new System.Drawing.Size(, );
this.textBoxInput.TabIndex = ;
//
// textBoxFileName
//
this.textBoxFileName.Enabled = false;
this.textBoxFileName.Location = new System.Drawing.Point(, );
this.textBoxFileName.Name = "textBoxFileName";
this.textBoxFileName.Size = new System.Drawing.Size(, );
this.textBoxFileName.TabIndex = ;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.textBoxLastAccessTime);
this.groupBox2.Controls.Add(this.textBoxCreationTime);
this.groupBox2.Controls.Add(this.textBoxLastWriteTime);
this.groupBox2.Location = new System.Drawing.Point(, );
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(, );
this.groupBox2.TabIndex = ;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Details of Selected File";
//
// listBoxFiles
//
this.listBoxFiles.Location = new System.Drawing.Point(, );
this.listBoxFiles.Name = "listBoxFiles";
this.listBoxFiles.Size = new System.Drawing.Size(, );
this.listBoxFiles.TabIndex = ;
this.listBoxFiles.SelectedIndexChanged += new System.EventHandler(this.OnListBoxFilesSelected);
//
// listBoxFolders
//
this.listBoxFolders.Location = new System.Drawing.Point(, );
this.listBoxFolders.Name = "listBoxFolders";
this.listBoxFolders.Size = new System.Drawing.Size(, );
this.listBoxFolders.TabIndex = ;
this.listBoxFolders.SelectedIndexChanged += new System.EventHandler(this.OnListBoxFoldersSelected);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.groupBox5);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.textBoxFileSize);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.textBoxFileName);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.textBoxFolder);
this.groupBox1.Controls.Add(this.groupBox2);
this.groupBox1.Location = new System.Drawing.Point(, );
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(, );
this.groupBox1.TabIndex = ;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Contents of folder";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(, );
this.Controls.Add(this.label1);
this.Controls.Add(this.label8);
this.Controls.Add(this.label2);
this.Controls.Add(this.buttonDisplay);
this.Controls.Add(this.buttonUp);
this.Controls.Add(this.textBoxInput);
this.Controls.Add(this.listBoxFiles);
this.Controls.Add(this.listBoxFolders);
this.Controls.Add(this.groupBox1);
this.Name = "Form1";
this.Text = "FilePropertiesAndMovement Sample";
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout(); } #endregion private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.TextBox textBoxNewPath;
private System.Windows.Forms.Button buttonDelete;
private System.Windows.Forms.Button buttonCopyTo;
private System.Windows.Forms.Button buttonMoveTo;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBoxLastAccessTime;
private System.Windows.Forms.TextBox textBoxLastWriteTime;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox textBoxCreationTime;
private System.Windows.Forms.TextBox textBoxFileSize;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button buttonDisplay;
private System.Windows.Forms.TextBox textBoxFolder;
private System.Windows.Forms.Button buttonUp;
private System.Windows.Forms.TextBox textBoxInput;
private System.Windows.Forms.TextBox textBoxFileName;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.ListBox listBoxFiles;
private System.Windows.Forms.ListBox listBoxFolders;
private System.Windows.Forms.GroupBox groupBox1; }
}
C# 操作文件夹、文件的更多相关文章
- python 遍历文件夹 文件
python 遍历文件夹 文件 import os import os.path rootdir = "d:\data" # 指明被遍历的文件夹 for parent,dirn ...
- android多国语言文件夹文件汇总
android多国语言文件夹文件汇总如下: 中文(中国):values-zh-rCN 中文(台湾):values-zh-rTW 中文(香港):values-zh-rHK 英语(美国):values-e ...
- java基础IO删除文件夹文件
/** * 定义一个方法,能够删除任意文件夹,文件夹路径由键盘录入 注意:不要在C盘下做测试,请选定无用的文件夹测试! */ 1.键盘录入 private static File getfile() ...
- PHP文件夹文件拷贝/复制函数 dir_copy($src = '', $dst = '')
/* * 文件夹文件拷贝 * * @param string $src 来源文件夹 * @param string $dst 目的地文件夹 * @return bool */ function dir ...
- java实现基于关键字的文件夹(文件)的搜索、文件夹(文件)的复制、删除
最近在做一个项目,需要实现这几项功能,上网查了很多资料,自己研究了好几天终于实现了,现在与大家分享一下. 一.JAVA实现文件夹的搜索 在百度搜索N个技术文章,从哪些大牛们共享的资料中终于写出了我 ...
- JavaSE 文件递归之删除&获取文件夹文件夹中全部的以.jpg的文件的绝对路径
1.递归删除文件 假设一个文件夹以下还有子文件夹,进行删除的话会 报错,这个时候要使用递归的方式来删除这个文件文件夹中的全部文件以及文件夹 package cn.itcast.digui; impor ...
- Shell脚本递归打印指定文件夹中全部文件夹文件
#!/bin/bash #递归打印当前文件夹下的全部文件夹文件. PRINTF() { ls $1 | while read line #一次读取每一行放到line变量中 do [ -d $1/$li ...
- C#获取文件夹/文件的大小以及占用空间 转摘自:http://www.cnblogs.com/chenpeng-dota/articles/2176470.html
C#获取文件夹/文件的大小以及占用空间 今天,头给了个任务:写个方法,我会给你个路径,计算这个路径所占用的磁盘空间 . 然后,找了很多资料.但大部分都是获取文件夹/文件的大小的.对于占用空间的没有成品 ...
- C# 压缩 解压 复制文件夹,文件的操作
命名空间:namespace System.IO.Compression 压缩: //目标文件夹 string fileDirPath = "/Downloads/试题" + us ...
- 文件夹文件遍历并插入数据库的操作,IO Directory File的递归操作
在我们管理内容管理系统时,数据量大时,对机器的依赖性就比较强了,比如,我要将一个文件夹中的很多图片上传到网站,一个个上传会很花时间,就想到了通过遍历文件夹得到文件名,并将路径与文件保存到数据库中对应的 ...
随机推荐
- Java基础---Java常量
常量:在程序运行期间不变的量 分类: 类型 含义 数据举例 整数常量 所有整数 0,1, 567, -9 小数常量 所有小数 0.0, -0.1, 2.55 字符常量 单引号引起来,只能写一个字符, ...
- C++:链表(有头链表)
介绍 把链表分为无头链表和有头链表. 无头链表:所有的节点都包含了有效数据,上一篇文章中演示代码使用的就是无头链表. 有头链表:用一个固定的头节点来指代整个链表,所有的对象都挂在这个头节点下面,而头节 ...
- ubuntu系统里常用的几个命令
### ubuntu系统里常用的几个命令 卸载软件: sudo apt-get --purge remove easy-rsa //最后是包名, --purge是可选参数,加上的话移除配置文件 删除文 ...
- Excel常用操作1
1.数据透视 所在选项卡:插入-数据透视表 例如:查看下表中各个工龄的平均工资 数据透视:选择所有数据--数据透视表--数据透视字段:选择工作经验和salary 切片器的使用,根据工作经验进行切片(还 ...
- Django之ORM表操作
ORM表操作 1.ORM单表操作 首先想操作表的增删改查,需要先导入这个表,以之前创建的UserInfo表为例,在app下的views.py中导入 from app import models def ...
- Docker容器日志查看与清理的方法
Docker容器日志查看与清理的方法 Docker 容器是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的Linux机器上,也可以实现虚拟化.容器 ...
- 查准率(precision)和查全率(recall)
一.理解查准率(precision)& 查全率(recall) 我们在平时常用到的模型评估指标是精度(accuracy)和错误率(error rate),错误率是:分类错误的样本数站样本总数的 ...
- JavaScript--Function对象(函数)的声明和作用域
Funtion 封装了可重复使用的代码块对象,函数名是一个引用函数对象的变量 声明提前:在程序开始执行之前,将var 变量和function函数提前声明 但赋值并不会提前 它的三种创建方法: 创建1 ...
- js入门第一篇
简介:JavaScript 运行在客户端(浏览器)是一种客户端语言,javascript的引擎被称为JavaScript引擎,为浏览器的一部分广泛用于客户端的脚本语言 应用场景:网页特效, 服务端开发 ...
- ajax获取后台数据出错parsererror
原因是dataType如果为json,返回的数据是text就会报错.