【无标题】JS第四天

1. 写一个函数,能返回传入的任意两个数字的最大值。2. 写一个函数,能返回传入的任意三个数字的最大值。3. 写一个函数,能判断传入的一个数值是否是质数,如果是质数返回true,如果不是质数返回false,(质数:从2开始只能被1和自身整数的数)4. 写一个函数,能翻转传入的任意数组,并把翻转结果通过返回值返回。5. 写一个函数,能对所有传入的数组按照从小到大进行排序,并把排序结果通过返回值返回
摘要由CSDN通过智能技术生成

练习函数编写

1. 写一个函数,能返回传入的任意两个数字的最大值。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
写一个函数,能返回传入的任意两个数字的最大值。
<p id="max"> </p>
<script>
   var num1=prompt("请输入第一个数")
   var num2=prompt("请输入第2个数")
   var max=getMax(num1,num2)
   document.getElementById("max").innerHTML="最大值是:"+max
    function getMax(num1,num2){
        return num1>num2?num1:num2;
    }
</script>
</body>
</html>

2 写一个函数,能返回传入的任意三个数字的最大值。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
写一个函数,能返回传入的任意三个数字的最大值。
<br>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
可以使用第三方 JavaScript 库或框架来创建带标题的提示框,例如 Bootstrap 的 `modal` 组件。 以下是一个使用 Bootstrap 创建带标题的提示框的示例代码: ```html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Custom Alert Dialog</title> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="//code.jquery.com/jquery-3.2.1.min.js"></script> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> </head> <body> <script> $(function() { $("#show-dialog").click(function() { $("#myModal").modal({ show: true, backdrop: true, keyboard: true, focus: true }); }); }); </script> <button id="show-dialog">Show Custom Alert</button> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title" id="myModalLabel">Custom Alert</h4> </div> <div class="modal-body"> <p>This is a custom alert dialog.</p> <p>You can modify the title, content and buttons.</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">OK</button> </div> </div> </div> </div> </body> </html> ``` 在这个示例中,我们使用 Bootstrap 的 `modal` 组件来创建一个带标题的提示框,并设置了标题为“Custom Alert”。点击“Show Custom Alert”按钮即可打开这个提示框。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值