使用这个功能,我有7天的差异; 如何测试日期是否在当前日期之前?
function validateDate() {
pickedDate = Date.parse("05-Jul-2012".replace(/-/g, " "));
todaysDate = new Date();
todaysDate.setHours(0, 0, 0, 0);
dateDifference = Math.abs(Number(todaysDate) - pickedDate);
//7 Days=604800000ms
if (dateDifference > 604800000) {
return false;
} else {
return true;
}
}
Run Code Online (Sandbox Code Playgroud) 我想使用Windows Shift和Ctrl键选择多行,例如Windows中的多个文件夹选择.
从所选行的表中我必须得到第一列(学生ID)并传递到服务器端C#并从数据库中删除这些记录.
我在javascript中编写了一个代码,但是类名未应用于<tr>on Shift或Ctrl+ 左键单击.
HTML
<table id="tableStudent" border="1">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Class</th>
</tr>
</thead>
<tbody>
<tr onmousedown="RowClick(this,false);">
<td>1</td>
<td>John</td>
<td>4th</td>
</tr>
<tr onmousedown="RowClick(this,false);">
<td>2</td>
<td>Jack</td>
<td>5th</td>
</tr>
<tr onmousedown="RowClick(this,false);">
<td>3</td>
<td>Michel</td>
<td>6th</td>
</tr>
<tr onmousedown="RowClick(this,false);">
<td>4</td>
<td>Mike</td>
<td>7th</td>
</tr>
<tr onmousedown="RowClick(this,false);">
<td>5</td>
<td>Yke</td>
<td>8th</td>
</tr>
<tr onmousedown="RowClick(this,false);">
<td>6</td>
<td>4ke</td>
<td>9th</td>
</tr>
<tr onmousedown="RowClick(this,false);">
<td>7</td>
<td>7ke</td>
<td>10th</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
JavaScript的
var selectedrow;
function …Run Code Online (Sandbox Code Playgroud) $(document).live('mouseup', function () {
flag = false;
});
var colIndex;
var lastRow;
$(document).on('mousedown', '.csstablelisttd', function (e) {
//This line gets the index of the first clicked row.
lastRow = $(this).closest("tr")[0].rowIndex;
var rowIndex = $(this).closest("tr").index();
colIndex = $(e.target).closest('td').index();
$(".csstdhighlight").removeClass("csstdhighlight");
if (colIndex == 0 || colIndex == 1) //)0 FOR FULL TIME CELL AND 1 FOR TIME SLOT CELL.
return;
if ($('#contentPlaceHolderMain_tableAppointment tr').eq(rowIndex).find('td').eq(colIndex).hasClass('csstdred') == false) {
$('#contentPlaceHolderMain_tableAppointment tr').eq(rowIndex).find('td').eq(colIndex).addClass('csstdhighlight');
flag = true;
return false;
}
});
Run Code Online (Sandbox Code Playgroud)
我正在拖动表格单元格.在拖动(向下移动方向)时,我也必须移动表格滚动.而且我想选择反向(向上方向)的单元格.我该怎么办.
我在tr课上做了选择.
CREATE TABLE [Users_Reg]
(
[User_ID] [int] IDENTITY (1, 1) NOT NULL CONSTRAINT User_Reg_P_KEY PRIMARY KEY,
[Name] [varchar] (50) NOT NULL,
[Type] [varchar] (50) NOT NULL /*Technician/Radiologist*/
)
CREATE Table [Study]
(
[UID] [INT] IDENTITY (1,1) NOT NULL CONSTRAINT Patient_Study_P_KEY PRIMARY KEY,
[Radiologist] [int], /*user id of Radiologist type*/
[Technician] [int], /*user id of Technician type*/
)
select * from Study
inner join Users_Reg
on Users_Reg.User_ID=Study.Radiologist
Run Code Online (Sandbox Code Playgroud)
在patient_study表中,放射科医师或技师可能有0值.我如何从查询中获得技术员姓名和放射科医生姓名.
在Microsoft Word中,我创建了openxml.doc(*.docx)文件,将凭据'abc'作为Readpassword,将'xyz'作为WritePassword.
现在我必须将openxml.doc转换为binary.doc(WdSaveFormat = 0),使用下面的代码将文档作为Binary.doc成功创建
// Convert OpenXml.doc into binary.doc
Convert(@"C:\Test\OpenXml.doc", @"C:\Test\binary.doc", WdSaveFormat.wdFormatDocument);
// Convert a Word .docx to Word 2003 .doc
public static void Convert(string input, string output, WdSaveFormat format)
{
// Create an instance of Word.exe
Word._Application oWord = new Word.Application();
// Make this instance of word invisible (Can still see it in the taskmgr).
oWord.Visible = false;
// Interop requires objects.
object oMissing = System.Reflection.Missing.Value;
object isVisible = true;
object readOnly = false;
object oInput = input; …Run Code Online (Sandbox Code Playgroud) public static void ToggleTaskManager(string keyValue)
{
RegistryKey objRegistryKey = Registry.CurrentUser.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System");
objRegistryKey.SetValue("DisableTaskMgr", keyValue);
objRegistryKey.Close();
}
private void btnDisableTaskManager_Click(object sender, EventArgs e)
{
ConsoleDisplay.ToggleTaskManager("1");
}
private void btnEnableTaskManager_Click(object sender, EventArgs e)
{
ConsoleDisplay.ToggleTaskManager("0");
}
Run Code Online (Sandbox Code Playgroud)
对于上面使用的禁用/启用 TaskManager 功能,但是当我第一次禁用时,它会正确禁用。但是当我单击启用按钮时 TaskManager 未启用。
var time="18:15:00"
我正在以24小时格式获得时间,如上面的字符串.我必须添加15分钟的时间我如何添加.不使用substring().
var time 字符串不是date object.在谷歌搜索但没有得到它.
我无法在C#中拆分字符串以分隔符&&和||.
例如,字符串可能如下所示:
"(abc)&&(rfd)&&(5)||(hh)&&(nn)||(iu)"
Run Code Online (Sandbox Code Playgroud)
码:
string[] value = arguments.Split(new string[] { "&&" }, StringSplitOptions.None);
Run Code Online (Sandbox Code Playgroud)
我需要在没有()大括号的数组中拆分或检索值- 我需要输出
"abc" "rfd" "5" "nn" "iu"
Run Code Online (Sandbox Code Playgroud)
我需要一个数组
Dictionary<string, string> dict = new Dictionary<string, string>();
dict.Add("a", "value1");
dict.Add("abc", "value2");
dict.Add("5", "value3");
dict.Add("rfd", "value4");
dict.Add("nn", "value5");
dict.Add("iu", "value6");
foreach (string s in strWithoutBrackets)
{
foreach (string n in dict.Keys)
{
if (s == n)
{
//if match then replace dictionary value with s
}
}
}
///Need output like this
string outputStr …Run Code Online (Sandbox Code Playgroud) 我必须使用javascript打开单击按钮的窗口作为模式对话框.我使用了window.open,但它显示了两个实例父页面以及弹出页面.当弹出页面打开时,不允许单击父页面.
function openWindow() {
var w = 950;
var h = 350;
var t = 0;
var l = 0;
var scrollbars = 1;
var modal = 'yes';
var reportWindow = window.open("Search.aspx" + '', '', "width=" + w + ",height=" + h + ",left=" + l + ",top=" + t + ',scrollbars=' + scrollbars + 'modal' + modal);
reportWindow.focus();
}
Run Code Online (Sandbox Code Playgroud) string[] array = new string[] { "12", "3$4", "5$67", "8$945", "$9484$", "$63$" };
foreach(string message in array)
{
FindString(message);
}
string remainingString = "";
string tempString = "";
string outputString = "";
Run Code Online (Sandbox Code Playgroud)
这就是 FindString
private void FindString(string message)
{
if(message.Contains("$"))
{//remove char ^ process
int pos = -1;
pos = message.IndexOf('$');
outputString = message.Substring(0, pos);
remainingString = message.Substring(pos + 1);
if(tempString != "")
{
outputString = tempString + outputString;
objList.Add(outputString);
tempString = "";
}
if(remainingString.Length != 0)
{
FindString(remainingString);
//remainingString …Run Code Online (Sandbox Code Playgroud) UserID UserName Password
1 abc 123
10 xyz 456
3 mno 254
SELECT MAX(UserId) AS UserId FROM UserLogin
Run Code Online (Sandbox Code Playgroud)
当我运行此查询时,它给了我3而不是10
所有列都是TEXT数据类型