• 真不知道起什么名字了


      hi

    早上好,难得早上能见到太阳,虽然昨晚睡得不太平,原因都还不知道,可能,是低开高走吧。

    昨天刚好完成任务,还不错,继续保持并多一点吧亲~

    上班去了

    -----------------08:53-------------------

    1、JS

    -判断类型语句练习

    <!DOCTYPE  HTML>
    <html >
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>函数</title>

    <script type="text/javascript">

    //定义函数
    function bothmax(a,b){
        if(a>b){
            maxo=a;
        }else if(b>a){
            maxo=b;
        }else{
            maxo="两个数字相等";
        }
        return maxo;
    }

    //函数体,判断两个整数比较的三种情况
    re1=bothmax(5,4);
    re2=bothmax(6,3);
     
    //调用函数,实现下面两组数中,返回较大值。
      document.write(" 5 和 4 的较大值是:"+re1+"<br>");
      document.write(" 6 和 3 的较大值是:"+re2 );
    </script>
    </head>
    <body>
    </body>
    </html>

    -事件:onclick="function_name()"

    类似的还有onmouseover,onmouseout,onblur,onfocus,onselect

    <!DOCTYPE html>
    <html>
     <head>
      <title> 事件</title>  
      <script type="text/javascript">
       function count(){   
            var txt1   = parseInt( document.getElementById('txt1').value);//获取第一个输入框的值
            var txt2   = parseInt( document.getElementById('txt2').value);//获取第二个输入框的值
            var select = document.getElementById('select').value;//获取选择框的值
            var result = '';
            switch (select)
             {
                case '+':
                    result = txt1 + txt2;
                    break;
                case '-':
                    result = txt1 - txt2;
                    break;
                case '*':
                    result = txt1 * txt2;
                    break;
                case '/':
                    result = txt1 / txt2;
                    break;  
             }
             document.getElementById('fruit').value = result;//设置结果输入框的值
       }
      </script>
     </head>
     <body>
       <input type='text' id='txt1' />
       <select id='select'>
            <option value='+'>+</option>
            <option value="-">-</option>
            <option value="*">*</option>
            <option value="/">/</option>
       </select>
       <input type='text' id='txt2' />
       <input type='button' value=' = ' onclick="count()"/> <!--通过 = 按钮来调用创建的函数,得到结果-->
       <input type='text' id='fruit' />   
     </body>
    </html>

    --------------16:47-----------------

  • 相关阅读:
    Qt 学习之路 :自定义只读模型
    Qt 学习之路:QSortFilterProxyModel
    Qt 学习之路 :可视化显示数据库数据
    Qt 学习之路 :访问网络(4)
    Qt 学习之路:QFileSystemModel
    高级Bash脚本编程指南
    CGI
    shell学习
    【shell】while read line 与for循环的区别
    管道技巧-while read line
  • 原文地址:https://www.cnblogs.com/andy1202go/p/4876401.html
Copyright © 2020-2023  润新知