English 中文(简体)
为什么我所说的表格不归还?
原标题:Why is my named form not being returned?

在以下法典中,我犯了一个错误。

不能将“Area Sorted”改为未界定的财产

当我说一线时

document.SortingForm.AreaSorted.value = Names.join("
");

我已超过100次,我看不出为什么出现这种情况。 我真的希望得到任何帮助。

sort.html>

<!doctype html>
<html>
<title>Sort</title>
<head>
    <script type="text/javascript" src="sort.js">
    </script>
</head>
<body>
<h1>Sorting String Arrays</h1>
<p>Enter two or more names in the field below,
and the sorted list of names will appear in the
text area.</p>
<form name=”SortingForm”>
Name:
<input type="text" name="FieldWord" size="20" />
<input type="button" name="ButtonAddWord" value="Add" onClick="SortNames();" />
<br/>
<h2>Sorted Names</h2>
<textarea name=”AreaSorted” cols=”60” rows=”10” >
The sorted names will appear here.
</textarea>
</form>

</body>
</html>

sort.js

var Names = new Array();

function SortNames()
{
    Name = document.getElementsByName("FieldWord")[0].value;
    Names.push(Name);
    Names.sort();
    document.SortingForm.AreaSorted.value = Names.join("
");
}
最佳回答

You have weird speechmarks around the name of the form: . I m a little suprised that using these is not valid though.

问题回答

为什么不要让你试图在文本领域增加一个助手并使用:

document.getElementById( AreaSorted );

无论采取什么形式,这都应始终奏效。

另外,在形式名称之前和之后的引言似乎已经消失,试图加以封杀。

我不知道这一辛迪克斯来自哪里,但很显然,它不从事任何工作。 为了按其名称查阅表格,请使用

document.forms.SortingForm.elements.AreaSorted.value = names.join("
");

但建议的方式是将<条码>id分配给投入,并使用<条码>文件.getElementById。

地区性用草原是用的。

document.getElementByName( AreaS或ted )[0]

. 给您一个内容贴近和使用文件.getElementById,我建议这样做。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.