onSubmit ="一大堆头痛“ [英] onSubmit="A whole bunch of headaches"

查看:67
本文介绍了onSubmit ="一大堆头痛“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我在使用下面的代码时遇到了问题,但似乎无法找到

问题。当我运行它时,它表示对象预期并指出第31行:

< form action =""方法= QUOT;交"名称= QUOT;工资" onSubmit =" earnings()">


任何人都可以通过我的方式发现错误。再次感谢你的帮助,你们

伙计们很棒我们让我的课堂SOOOOOO更容易。


TIA,

ML

<!DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.01 Transitional // EN">

< html>

< head>

< title>第4章 - 脚本练习5< / title>

< script language =" JavaScript" type =" text / javscript">

<! -

//开始计算并显示每周收入的功能

功能收入(){

var hrs = document.payroll.hours.value

var hrly = document.payroll.rate.value

var overtime = 0

var check = 0

var hrlypay = 0

var overtimepay = 0

parseFloat(hrs)

parseFloat(小时)

如果(小时> 40){

加班=小时 - 40

hrs = 40

}

hrylpay = hrs * hrly

overtimepay =加班费* hrly

check = hrlypay + overtimepay

提醒(工作总时数:+ +小时+\ nRegular Pay:" + hrs +" @ $" +

hrly + " / hour = $" + hrlypay)

}

//计算和显示每周收入的结束函数

// - >

< / script>

< / head>

< body>

<形成一个ction = QUOT;"方法= QUOT;交"名称= QUOT;工资" onSubmit =" earnings()">

< b>本周你工作了几个小时?& nbsp& nbsp< / b>

< ; input type =" text"名称= QUOT;小时"大小= QUOT; 6英寸maxlength =" 3">< br>

< b>您的每小时工资率是多少?& nbsp& nbsp< / b>

< input type =" text"名称= QUOT;速率"大小= QUOT; 6英寸maxlength =" 6">< br>

< input type =" submit"命名= [提交" value =" Calculate Earnings"& nbsp& nbsp

< input type =" reset"命名= QUOT;重置" value ="重置表格>

< / form>

< / body>

< / html>

Ok, I am having trouble with the code below, but cannot seem to find the
problem. When I run it, it says Object Expected" and points me to line 31:
<form action="" method="post" name="payroll" onSubmit="earnings()">

Can anyone spot teh error in my ways. Thanks again for all your help, you
guys have been great and our making my class SOOOOOO much easier.

TIA,
ML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Chapter 4 - Scripting Exercise 5</title>
<script language="JavaScript" type="text/javscript">
<!--
// Begin function to calcualte and display weekly earnings
function earnings() {
var hrs = document.payroll.hours.value
var hrly = document.payroll.rate.value
var overtime = 0
var check = 0
var hrlypay = 0
var overtimepay = 0
parseFloat(hrs)
parseFloat(hrly)
if (hrs > 40) {
overtime = hrs - 40
hrs = 40
}
hrylpay = hrs * hrly
overtimepay = overtime * hrly
check = hrlypay + overtimepay
alert("Total Hours Worked: " + hrs + "\nRegular Pay: " + hrs + " @ $" +
hrly + "/hour = $" + hrlypay)
}
// End function to calculate and display weekly earnings
// -->
</script>
</head>
<body>
<form action="" method="post" name="payroll" onSubmit="earnings()">
<b>How many hours did you work this week?&nbsp&nbsp</b>
<input type="text" name="hours" size="6" maxlength="3"><br>
<b>What is your hourly pay rate?&nbsp&nbsp</b>
<input type="text" name="rate" size="6" maxlength="6"><br>
<input type="submit" name="submit" value="Calculate Earnings">&nbsp&nbsp
<input type="reset" name="reset" value="Reset Form">
</form>
</body>
</html>

推荐答案

" +

hrly +" / hour =
" +
hrly + "/hour =


" + hrlypay)

}

//计算和显示每周收入的结束函数

// - >

< / script>

< / head>

< body>

< form action =""方法= QUOT;交"名称= QUOT;工资" onSubmit =" earnings()">

< b>本周你工作了几个小时?& nbsp& nbsp< / b>

< ; input type =" text"名称= QUOT;小时"大小= QUOT; 6英寸maxlength =" 3">< br>

< b>您的每小时工资率是多少?& nbsp& nbsp< / b>

< input type =" text"名称= QUOT;速率"大小= QUOT; 6英寸maxlength =" 6">< br>

< input type =" submit"命名= [提交" value =" Calculate Earnings"& nbsp& nbsp

< input type =" reset"命名= QUOT;重置" value ="重置表格>

< / form>

< / body>

< / html>

" + hrlypay)
}
// End function to calculate and display weekly earnings
// -->
</script>
</head>
<body>
<form action="" method="post" name="payroll" onSubmit="earnings()">
<b>How many hours did you work this week?&nbsp&nbsp</b>
<input type="text" name="hours" size="6" maxlength="3"><br>
<b>What is your hourly pay rate?&nbsp&nbsp</b>
<input type="text" name="rate" size="6" maxlength="6"><br>
<input type="submit" name="submit" value="Calculate Earnings">&nbsp&nbsp
<input type="reset" name="reset" value="Reset Form">
</form>
</body>
</html>


micahl0180写道:
micahl0180 wrote:
好的,我遇到下面的代码有问题,但似乎无法找到
问题。当我运行它时,它表示对象预期并指出第31行:
< form action =""方法= QUOT;交"名称= QUOT;工资" onSubmit =" earnings()">

任何人都可以通过我的方式发现错误。再次感谢你们的帮助,你们这些人很棒我们让我的课堂SOOOOOO更容易。

TIA,
ML

< !DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.01 Transitional // EN">
< html>
< head>
< title>第4章 - 脚本练习5< / title>
< script language =" JavaScript" type =" text / javscript">
<! -
//开始计算并显示每周收入的函数
函数收益(){
var hrs = document .payroll.hours.value
var hrly = document.payroll.rate.value
var overtime = 0
var check = 0
var hrlypay = 0
var overtimepay = 0
parseFloat(小时)
parseFloat(小时)
如果(小时> 40){
超时=小时 - 40
小时= 40
}
hrylpay = hrs * hrly
overtimepay =加班* hrly
check = hrlypay + overtimepay
alert(工作小时数:+ +小时+\ nRegular付款:+小时+@
Ok, I am having trouble with the code below, but cannot seem to find the
problem. When I run it, it says Object Expected" and points me to line 31:
<form action="" method="post" name="payroll" onSubmit="earnings()">

Can anyone spot teh error in my ways. Thanks again for all your help, you
guys have been great and our making my class SOOOOOO much easier.

TIA,
ML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Chapter 4 - Scripting Exercise 5</title>
<script language="JavaScript" type="text/javscript">
<!--
// Begin function to calcualte and display weekly earnings
function earnings() {
var hrs = document.payroll.hours.value
var hrly = document.payroll.rate.value
var overtime = 0
var check = 0
var hrlypay = 0
var overtimepay = 0
parseFloat(hrs)
parseFloat(hrly)
if (hrs > 40) {
overtime = hrs - 40
hrs = 40
}
hrylpay = hrs * hrly
overtimepay = overtime * hrly
check = hrlypay + overtimepay
alert("Total Hours Worked: " + hrs + "\nRegular Pay: " + hrs + " @


这篇关于onSubmit =&quot;一大堆头痛“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆