本文介绍了JAVASCRIPT作业,我无法运行它,有人可以帮我修复代码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<html>
<head>
<script type="text/javascript">

// Program name: AccountClass.html
// Purpose: Use a constructer function
// to create an object
// Author: Arbr Krasniqi
// Date last modified: April-25th-2018

// Constructor function for the Account Class
Function account(type, num, 1name, fName, bal) {

this.acctType = type;
this.acctNumber = num;
this.lastName = 1Name;
this.firstName = fName;
this.acctBal = bal;
} // end Account function
</script>
</head>

<body>
<script type="text/javascript">

// Variables and Constants
var BR = "<br/>";   // HTML line break tag

// State program purpose
document.write("Account program." + BR);
document.write("This program creates an
Account." + BR);

// Create an Account object
var mySavingsAcct = new Account("S", 1376433,
"Dunes", "Sandi", 80.00);

//Thank the user and end the program
document.write("Thank you!" + BR);
</script>
</body>
</html>





我尝试过:



在mac上从texteditor打开文件作为html。



What I have tried:

Opening the file as a html from texteditor on mac.

推荐答案

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

// Program name: AccountClass.html
// Purpose: Use a constructer function
// to create an object
// Author: Arbr Krasniqi
// Date last modified: April-25th-2018

// Constructor function for the Account Class
function Account(type, num, name, fName, bal) {

this.acctType = type;
this.acctNumber = num;
this.lastName = name;
this.firstName = fName;
this.acctBal = bal;
}; // end Account function
</script>
</head>
<body>

<script>

// Variables and Constants
var BR = "<br/>";   // HTML line break tag 

// State program purpose 
document.write("Account program." + BR);
document.write("This program creates an Account." + BR);

// Create an Account object 
var mySavingsAcct = new Account("S", 1376433,"Dunes", "Sandi", 80.00);

//Thank the user and end the program
document.write("Thank you!" + BR);
</script>

</body>
</html>


这篇关于JAVASCRIPT作业,我无法运行它,有人可以帮我修复代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 04:26