English 中文(简体)
• 如何使无线电纽顿互动的文字现场能够/可操作?
原标题:How to enable/disable text field on radio button interaction?

无法做到这一点。 第一次使用变量作为功能。 互不兼容的无线电塔顿应构成外地,反之亦然。 线性变量将这一无线电/文稿与其他10个版本区分开来。

我的法典:

<script type="text/javascript">
function disablefield(lineid){ 
if (document.getElementById(lineid).checked == true){ 
document.dupedit.lineid.disabled = false;
} else { 
document.dupedit.lineid.disabled = true;
} 
}
</script>

我的超文本。

最佳回答

You need to pass a string into your disablefield function, so put the value in quotes when you pass it in. Something like:

<input onclick=“disablefield (2671997)”/>

这是因为:document.getElementById期望有扼杀,而不是ger。

Secondly, to enable/disable the field, you need to use disabled = true; rather than = disabled .

document.dupedit.lineid> is look a field with name “lineid”, which doesn t now form. 我建议再次向外地提供<代码>id和

如果您希望继续使用<代码> 姓名/代码>属性,你将不得不使用<编码>文件>。 这反映了一系列对应因素(因为多种要素可以共享同一名称),但如果你在法典中知道所涉内容是唯一与这一名称对应的内容,你可以这样做:

document.getElementsByName(lineid)[0].disabled = true;

您可以看到一份工作版本(我认为,这是你如何想到的)。 here是使用getElementsByName的版本。

问题回答

You are missing a closing brace on the function:

function disablefield(lineid){ 
if (document.getElementById(lineid).checked == true){ 
document.dupedit.lineid= enabled ;
}else{ 
document.dupedit.lineid= disabled ;
} 
} //<-- here

另外,我也可以建议你通过<条码>。 然后,不必打上<代码>。 ElementById

<input onclick= disablefield(this)  type.....

function disablefield(obj){ 
    if (obj.checked == true){ 
        document.dupedit.lineid= enabled ;
    }else{ 
        document.dupedit.lineid= disabled ;
    } 
} 

I think what you need is to re-think the code.

  • http://www.un.org。 更好地将这一身份识别系统移到文字领域,你希望能够消除/纠正,检查这个领域是否残疾/残疾,而不是检查箱本身。

  • 更清洁地使用共同材料。

请看the jsFiddle,我为您汇编。 难道你会做什么吗?





相关问题
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.

热门标签