function toggleFields() {
var type = document.getElementById("sourceType").value;
document.getElementById("book-fields").style.display = (type === "book") ? "block" : "none";
document.getElementById("journal-fields").style.display = (type === "journal") ? "block" : "none";
document.getElementById("website-fields").style.display = (type === "website") ? "block" : "none";
}
function generateCitation() {
var type = document.getElementById("sourceType").value;
var author = document.getElementById("author").value || "Unknown Author";
var year = document.getElementById("year").value || "n.d.";
var title = document.getElementById("title").value || "No Title";
var fullRef = "";
var inText = "";
if (type === "book") {
var city = document.getElementById("city").value;
var publisher = document.getElementById("publisher").value;
fullRef = author + " (" + year + ") " + title + ". " + (city ? city + ": " : "") + (publisher ? publisher + "." : "");
} else if (type === "journal") {
var journal = document.getElementById("journalTitle").value;
var vol = document.getElementById("volume").value;
var issue = document.getElementById("issue").value;
var pages = document.getElementById("pages").value;
fullRef = author + " (" + year + ") '" + title + "', " + journal + ", " + (vol ? vol : "") + (issue ? "(" + issue + ")" : "") + (pages ? ", pp. " + pages + "." : ".");
} else if (type === "website") {
var url = document.getElementById("url").value;
var accessDate = document.getElementById("accessDate").value;
fullRef = author + " (" + year + ") " + title + ". Available at: " + url + " (Accessed: " + accessDate + ").";
}
// Extract last name for in-text
var names = author.split(",");
var lastName = names[0].trim();
inText = "(" + lastName + ", " + year + ")";
document.getElementById("citationResult").innerHTML = fullRef;
document.getElementById("inTextResult").innerHTML = inText;
document.getElementById("output-area").style.display = "block";
}
Mastering Harvard Referencing
Harvard referencing is the backbone of academic writing in many disciplines, particularly in the humanities and social sciences. It utilizes an author-date system for in-text citations, making it easy for readers to locate sources in an alphabetical reference list at the end of the document.
Why is Referencing Important?
Correctly citing your sources is vital for three main reasons:
Academic Integrity: It gives credit to original authors and avoids plagiarism.
Evidence: It shows that your arguments are supported by existing research.
Traceability: It allows your professors and peers to find the original material you used.
Common Harvard Formatting Examples
Using our Harvard Referencing Calculator simplifies the process, but understanding the underlying structure is helpful:
Book Example: Bell, J. (2014) Doing Your Research Project. Maidenhead: Open University Press.
Journal Article Example: Dawson, J. (2019) 'Sustainable Agriculture', Journal of Environmental Studies, 14(2), pp. 45-58.
Website Example: World Health Organization (2023) Nutrition. Available at: https://www.who.int/health-topics/nutrition (Accessed: 12 June 2023).
How to Use This Calculator
Select the Source: Choose between a Book, Journal Article, or Website.
Input Metadata: Enter details like the author's surname and initial, the year of publication, and the title.
Specify Details: For books, include the city and publisher. For journals, enter the volume and page numbers.
Generate: Click the button to instantly get both the full reference list entry and the in-text citation snippet.
Tips for Error-Free Citations
Ensure that you use the exact punctuation required by your university's specific Harvard style guide. While the general "author-date" rule applies globally, some institutions prefer specific capitalization or italics settings. Always check if you need to include "pp." for page ranges or just "p." for a single page.