我需要一个快速文本输入对话框(MessageBox中有一个文本框).有没有可用的控件或我应该使用表格?
我只想让用户输入一些ID.在其他场合我想要2个texbox用于用户名和密码.
我用来收集文本InputBox的当前函数显然不能接受超过255个字符,我需要能够收集更多吗?我可以用一个参数或不同的功能来增加这个限制吗?
当达到输入的最大长度时,我使用下面的 JavaScript 将焦点更改为表单中的下一个输入。它在台式机上运行良好,但在平板电脑上不起作用。当当前输入失去焦点时,虚拟键盘会自行关闭,下一个输入框也不会获得焦点。
有谁知道如何在不使用本机“下一步”按钮的情况下更改平板电脑上的输入焦点?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, maximum-scale=1.0" />
<title>inpuTest</title>
<script language="JavaScript">
function myCtrl(elmnt)
{
if (elmnt.value.length==elmnt.maxLength)
{
next=elmnt.tabIndex
if (next<document.frmContact.elements.length)
{
document.frmContact.elements[next].focus()
}
}
}
</script>
<style type="text/css">
form{
margin:0 auto;
background-color:#CCC;
padding:2%;
border:1px solid #999;
}
form input,textarea{
width:96%;
}
</style>
</head>
<body>
<form name="frmContact" method="post">
<strong>1. Your name:</strong> <span class="times_17">(max-lenght 4)</span><br /><br />
<input name="formName" tabindex="1" value="" placeholder="Name" maxlength="4" type="text" …Run Code Online (Sandbox Code Playgroud) 我目前在我的VBA代码中有以下行Inputbox:
Set myValues = Application.InputBox("Please select on the spreadsheet the first cell in the column with the values that you are looking for:", Type:=8)
但是,当我选择单元格时,它会自动输入例如$A$1. 这是否可以更改,而无需用户手动删除 $,以便Inputbox自动选择单元格引用为A1?
它是自动VLookup宏的一部分,除了VLookup整列中固定的值之外,它完美地工作。
提前致谢。
更新 - 这是完整的代码:
Dim FirstRow As Long
Dim FinalRow As Long
Dim myValues As Range
Dim myResults As Range
Dim myCount As Integer
Sub VlookupMacroNew()
Set myValues = Application.InputBox("Please select on the spreadsheet the first cell in …Run Code Online (Sandbox Code Playgroud) 以下代码测试网页的自动裁剪框:
public class Test {
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.chrome.driver","chromedriver\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://www..............com");
driver.switchTo().frame("mainFrame");
WebDriverWait waitst = new WebDriverWait(driver, 120);
waitst.until(ExpectedConditions.visibilityOfElementLocated(By.name("sourceTitle")));
WebElement sourceTitle = driver.findElement(By.name("sourceTitle"));
WebElement small = driver.findElement(By.cssSelector("li#nameExampleSection label + small"));
sourceTitle.sendKeys("Times");
Thread.sleep(5000);
Actions actions = new Actions(driver);
actions.click(small).perform();
}
}
Run Code Online (Sandbox Code Playgroud)
为什么自动提示框没有加载?重要提示:尝试手动输入"..........." ...自动完成框将加载完全正常!那么,为什么不起作用cssSelector,为什么不加载自动完成框?
为什么自动输入不允许自动完成选项但是手动输入呢???
PS:我也试过fireEvent,sendKeys但没有任何作用.
我试图在文本字段/输入框中的光标后添加不可编辑的文本,以实现以下目的:
1)光标前的文本是可编辑的2)光标后的文本不可编辑,并且随着向左/向左的文本的添加/删除而向右/向左移动
输入字段:[editabletexthere {cursorhere} non-editabletexthere]
到目前为止,这是我输入框的代码:
<input id="edit_input" type="text" autocapitalize="off" autocorrect="off" spellcheck="false" autofocus onfocus="this.value = this.value;" value="editabletext" style="width:100%;"></input>
Run Code Online (Sandbox Code Playgroud)
我觉得输入中的值应该放在一个范围内,而第二个范围只需使用contenteditable = false;进行样式化即可。我还想将不可编辑的文本样式化为另一种颜色。任何帮助将非常感激。谢谢。
我正在尝试创建一个函数,该函数将查看用户名(如果无效),然后向用户发送警报,清除用户名字段,然后将用户名字段重新置于焦点中。我正在尝试使用 getElementsBynName() 函数来完成这一切。除了让现场重新成为焦点之外,一切都在进行。我的代码如下。有没有人有什么建议。
function uchecker(uname)
{
var validUname = uname.search(/^\w+@sabc.com$/);
if(validUname != 0)
{
alert("You have entered an invalid username. \n The username must be a valid @sju.edu email address value " + document.getElementsByName('uname')[0].value);
document.getElementsByName('uname')[0].value = null;
document.getElementsByName('uname')[0].focus();
/I have also tried document.getElementsByName('uname').focus, document.getElementsByName('uname')[0].value.focus();
}
Run Code Online (Sandbox Code Playgroud)
}
因此,在 Java 脚本运行之前,焦点字段会更改为下一个字段,即我的密码输入框……它也有自己的验证功能。我有办法让我的 javascript 代码在下一个文本框(密码框)获得焦点之前为我的用户名字段运行吗?
假设我有以下代码
.username {
font-size: 30px;
padding-top: 8px;
padding-bottom: 8px;
border: 2px solid #E0E0E0;
}Run Code Online (Sandbox Code Playgroud)
<input class="username" type="text" />Run Code Online (Sandbox Code Playgroud)
请参阅http://jsbin.com/qudorugoguya/1/edit?html,css,output上的现场演示
据我所知,总高度=内容高度+填充顶部+填充底部+(边框宽度x 2).
http://www.w3.org/TR/CSS21/box.html#box-dimensions
但是,如果未为height属性分配值,则计算的内容高度似乎会从浏览器更改为浏览器.好像是字体大小的结果+一些与字体大小成比例的任意数量的像素.
对于不同的浏览器,content height具有以下值:
注意:我从每个浏览器的内置开发人员工具中获取了值
有没有办法在不设置height属性和line-height属性的情况下从浏览器到浏览器获取一致的值?
我读了很多关于我的问题的答案,但不知怎的,如果我试图"模仿"我看到的东西,我仍然无法做我需要的东西.
问题非常简单:在打开的IE页面上填写输入框.
结果:代码卡在行上并getelementbyid显示运行时错误424(需要对象).
Private Sub AddInfoFromIntranet()
Dim ie As Object
Set ie = CreateObject("internetexplorer.application")
Application.SendKeys "{ESC}" ' I need this to ignore a prompt
With ie
.Visible = True
.navigate "{here goes the address of my website}"
Do Until Not .Busy And .readyState = 4
DoEvents
Loop
.document.getelementbyid("Nachnamevalue").Value = "{here goes whar I want to insert}"
End With
Set ie = Nothing
End Sub
Run Code Online (Sandbox Code Playgroud)
Internet Explorer库是自然导入的(否则"internetexplorer.application"将不起作用.
我很肯定我想要填写的字段被称为"Nachnamevalue",就像我今天早上在互联网上看到的那样.
我的网页的html代码(只有有趣的部分)看起来像这样:
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
'{here there are info …Run Code Online (Sandbox Code Playgroud) 我想在 AppleScript 中创建一个与此完全相同的对话框输入框: 
除了没有锁左上角的图片。
另外,我需要能够保存两个输入。
我知道我可以使用,tell application "System Events" to display dialog "blah blah" default answer "" end tell但我找不到一种方法来拥有多个和标记的字段。