请教html中if的用法,英语If用法

发布时间:2020-07-10 06:21:59

请教html中if的用法,英语If用法

网友回答

这是针对此问题的测试页面,下面详细解释。
  1、给第三个按钮绑定一个事件, onclick="fun()" 意思是点击时执行fun这个函数。
  <input type="text" name="001" id="001" value="文本框1" />
  <br>
  <br>
  <input type="text" name="002" id="002" value="文本框2" />
  <br>
  <br>
  <input type="button" name="003" id="003" value="按钮" onclick="fun()" />
  2、在javascript中声明fun函数。其中有个关键的地方是用document.getElementById('001').value这种写法获得id为"001"的文本框的值,同时可以用document.getElementById('002').value = 1;这种写法对id为"002"的文本框赋值。
  function fun() {
  if (document.getElementById('001').value == 'ok') {
  document.getElementById('002').value = 1;
  } else {
  document.getElementById('002').value = 2;
  }
  }
  3、这是运行效果  

网友回答

1.(表示条件)如果 ,主句用将来时,if从句用现在时表示将来
  He will e if you invite him.
  如果你请他,他会来的.
  2.(表示虚拟)假如,要是
  1)时态:可以表示过去,现在和将来的情况.它的基本特点是时态退后.
  a.同现在事实相反的假设.
  句型 :条件从句 主句
  一般过去时 should( would) +动词原形
  If they were here,they would help you.
  b.表示于过去事实相反的假设.
  句型:条件从句 主句
  过去完成时 should(would) have+ 过去分词
  If she had worked harder,she would have succeeded.
  The rice would not have been burnt if you had been more careful.
  If my lawyer had been here last Saturday,he would have prevented me from going.
  If he had e yesterday,I should / would have told him about it.
  含义:He did not e yesterday,so I did not tell him about it.
  If he had not been ill and missed many classes,he would have made greater progress.
  含义:He was ill and missed many lessons,so he did not make greater progress.
  c.表示对将来的假想
  句型:条件从句 主句
  一般过去时 should+ 动词原形
  were+ 不定式 would + 动词原形
  should+ 动词原形
  If you succeeded,everything would be all right.
  If you should succeed,everything would be all right.
  If you were to succeed,everything would be all right.
  3.是否 = whether 连接宾语从句
  I wonder if she is ill.
  不知她是否病了.
以上问题属网友观点,不代表本站立场,仅供参考!