HTML input onfocus & onblur?

后端 未结 5 851
醉话见心
醉话见心 2021-02-06 00:49

ok, today I\'m making a helper HTML function. It looks like this:

function Input($name,$type,$lable,$value= null){
  if (isset($value)) {
    //if (this.value==\         


        
5条回答
  •  走了就别回头了
    2021-02-06 01:49

    If I understand correctly, SO uses this line of HTML to do that effect.

     
    

    Not related to your question, but you could and should replace your second if statement with an else statement.

    function Input($name,$type,$lable,$value= null){
      if (isset($value)) {
        //if (this.value=='search') this.value = ''
        echo '';  
      }
      else {
        echo ''; 
      }
    }
    

    Because if isset($value) returns false then you know for a fact that it isn't set since it can only return one of two values, true or false.

    EDIT: Disregard this answer. It was not clear what the question was before the edit.

提交回复
热议问题