相关疑难解决方法(0)

如何使用JavaScript获取文本输入字段的值?

我正在使用JavaScript进行搜索.我会使用一个表单,但它在我的页面上弄乱了其他东西.我有这个输入文本字段:

<input name="searchTxt" type="text" maxlength="512" id="searchTxt" class="searchField"/>
Run Code Online (Sandbox Code Playgroud)

这是我的JavaScript代码:

<script type="text/javascript">
  function searchURL(){
    window.location = "http://www.myurl.com/search/" + (input text value);
  }
</script>
Run Code Online (Sandbox Code Playgroud)

如何从文本字段中获取值到JavaScript?

javascript dom input

804
推荐指数
11
解决办法
205万
查看次数

将html值传递给javascript函数

我正在制作一个javascript函数,我需要确认输入.我写了下面的代码,但即使输入有效值,它给出负值即"其他"部分.有人可以建议一个解决方案吗?

Html文件:

<!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" />
<title>Javascript App</title>
<script type="text/javascript" src="app1.js">

</script>
</head>
<body><h1 id="heading1" style="text-align:center; height:auto; width:auto; font-family:'Arial Black', Gadget, sans-serif">Determinant of a nxn matrix</h1> 
<p id="paragraph1" style="font-family:'Arial Black', Gadget, sans-serif"> This program allows you to compute the determinant of a nxn matrix</p>

<p>
Input the order of the matrix
<br />

<input type="text" maxlength="3" name="value" />
<input type="button" value="submit" onclick="verifyorder(value)" />
</p>
<p id="error"></p>
<p id="detspace"></p> …
Run Code Online (Sandbox Code Playgroud)

html javascript

9
推荐指数
2
解决办法
13万
查看次数

标签 统计

javascript ×2

dom ×1

html ×1

input ×1