I am trying to create a function that when executed checks whether the substring
of the value of a <input>
is equal to link or link , but it is not working.
Is there something wrong with the code?
function goToWebsite() {
var addressBarValue = document.getElementById('AddressBar').value;
var frameSrc = document.getElementById('Frame').src;
if ((addressBarValue.substring(0, 7) == "http://") || (addressBarValue.substring(0, 8) == "https://")) {
frameSrc = addressBarValue;
} else {
frameSrc = "http://" + addressBarValue;
}
}