So basically what I'm trying to do is to block access to submit information. I usually do this by onsubmit=CheckForm() and if a false is returned then the data just won't be sent. In this code, I'm using different functions and haven't found a way in which I could return false and not allow to continue.
*The functions basically say if the typed URL is a valid image, or not, by an alert. After the alert, it sends the data. I would like it to show the alert, but just simply not send anything but refresh(For instance).
Javascript:
var test = function () {
document.getElementById('image2').src = document.getElementById('image').value;
}
var errorCallback = function () {
alert('Image did not exist');
return false;
}
var loadCallback = function () {
alert('Image existed');
}
HTML:
<p style="font-size:20px; font-family:Arial; font-weight:800;">URL to prested Image: </p><input type="text" id="image" name="image" class="URLs" value="http://"/>
<p><input type="submit" class="myButton" style="padding: 25px 150px; line-height:6px;" value="Submit Details" onclick="test()" /></p>
<img style="display: none" id="image2" onerror="errorCallback()" onload="loadCallback()" />
Thanks in advance!