douti0467 2016-02-01 16:35
浏览 73

用于计算简单公式的显示结果的html / php表单

I'm need a HTML/php form on a webpage that solves the following formula, without refreshing the page. I'm struggling with how best to go about it and the code needed to accomplish the task.

The formula needed would be as follows:

100 / ((X * 2)+3) =Y

X being input into an input box by the user, or selected from a drop down.

Y being the result displayed, rounded down, with no decimal places, either worked out live upon input/selection or displayed upon a button press.

Is there anyone out there who can help me?

  • 写回答

1条回答 默认 最新

  • dongluo1853 2016-02-01 16:41
    关注

    You won't need PHP for this, plain javascript or jQuery will do.

    I've created a quick JSFiddle for you.

    $('#btnCalc').click(function(e)
    {
    var num = $('#txtNo').val();
    var result = Math.floor(100 / ((num * 2)+3));
    $('#result').html('Value is ' + result);
    });
    
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题