1
Web Oriented Coding / Simple Javascript Help
« on: February 07, 2015, 02:47:28 PM »
I am not sure what I am doing wrong. I have a simple HTML file that points to a javascript function.
HTML
--------------------
JS file is: Test.js
--------------------------
------------------------------------
I cannot get my browser to show me an alert. Any thoughts as to why?
I took the liberty of adding /code/ tags to your post - Phage
HTML
--------------------
Code: [Select]
<!DOCTYPE html>
<html>
<head>
<title>Javascript Test</title>
<script type="text/javascript" src="Test.js"></script>
</head>
<body>
<input type="text" name="txtFirstName" id="txtFirstName" placeholder="First Name" />
<br />
<br />
<input type="text" name="txtLastName" id="txtLastName" placeholder="Last Name" />
<br />
<br />
<button onclick="CombineName();">Click Me</button>
</body>
</html>
JS file is: Test.js
--------------------------
Code: [Select]
function CombineName()
{
var FirstName = document.getElementByld("txtFirstName").innerText;
var LastName = document.getElementByld('txtLastName')/innerText;
CombineName5 = txtFirstName + txtLastName;
alert(CombineName5);
}
------------------------------------
I cannot get my browser to show me an alert. Any thoughts as to why?
I took the liberty of adding /code/ tags to your post - Phage