禁用javascript函数

时间:2015-08-19 13:06:18

标签: javascript function microsoft-dynamics

我正在尝试禁用javascript函数,具体取决于单选按钮的选择。 如果单选按钮设置为“是”'然后禁用一个函数(在自动填充多个日期字段的字段中),以便用户可以自由填充该字段而不自动填充其他日期字段。 有意义吗?

干杯

亚伦

2 个答案:

答案 0 :(得分:0)

使用类似的东西:

$('#your_radio_button_group_id').change(function(){
   //use conditional if to check which radio has been checked
   if($('#r1').attr("checked"))
   {
      //disable/enable elements
   }
});

请参阅JSFiddle示例http://jsfiddle.net/N9tBx/

答案 1 :(得分:0)

你好吗?也许这段代码可以帮助你(参见示例https://jsfiddle.net/v1wm5k3j/):

HTML:

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

int main()
{
char name[100];
char password[100];

printf("Welcome to Skynet servers, please enter your username and password in the form below. \n");
printf("username: ");
scanf(" %s", name);
printf("password: ");
scanf(" %s", password);

if(strcmp(password, "skynet") == 0){
    printf("\n Welcome, Mr. %s, to your personal Skynet account", name);
}else {
    printf("ERROR: USERNAME OR PASSWORD INCORRECT. LEAVE THIS TERMINAL OR SECURITY WILL BE ALERTED!!!");
}


return 0;
}

JS:

<form>
<input type="radio" name="op" value="1">YES
<br>
<input type="radio" name="op" value="0">NO
<br>
<button id="btn1" type="button">Click Me!</button>
</form>