我想在我的网站上加一个源码部分。为此,我需要将名称、作者、页面、日期、出版商等文本类型输入转换为MLA和APA格式样式。我该怎么做呢?
发布于 2017-03-06 13:41:57
我将只使用连接运算符(+)。或者,如果您有可用的ES6特性,那么我将使用模板字符串。
图书示例(格式:姓氏,名字。书名。出版商城市:出版商名称、出版年份。中。):
function convertToCitation() {
var lastName = yourForm.lastName.value;
var firstName = yourForm.firstName.value;
var bookTitle = yourForm.bookTitle.value;
var publisherCity = yourForm.publisherCity.value;
// ... repeat for all the other fields
return lastName + ', ' + firstName + '. ' + bookTitle + '. '
// ... repeat for all the other fields
// Or, if you have ES6 available...
return `${lastName}, ${firstName}. ${bookTitle}.....repeat for other fields`;
}https://stackoverflow.com/questions/42618185
复制相似问题