I am trying to store the link the user clicked on in an Access database. I have completed the Access coding which is NOT included below. I have also completed the code to determine the link, which is included below. When the user clicks myAnchor2,
http://www.cnn.com is successfully stored since it can be displayed with the document.write command. However, when I try to save it to a text field on the form, it says: document.frmURLHistoryCheck.URLNM is Null or Not an Object. I believe that since we did not click the submit button that URLNM does not yet exist. Is there a way to have say 5 different anchors displayed, and have the user click one of them, determine what the URL was with the code listed below, and then store it to a text field and write it to an Access database?
I think what it would have to involve is somehow triggering the submit button from the Javascript and also trigging the vbscript from the Javascript which will save the value in the text field to the Access database. Is this possible? -
-
function FindLink()
-
{
-
document.write(document.getElementById('myAnchor2').href);
-
document.frmURLHistoryCheck.URLNM.value = document.getElementById('myAnchor2').href
-
}
-
-
<form method="POST" action="URLHistoryCheck2.asp" name="frmURLHistoryCheck" >
-
-
<a id="myAnchor2" href="http://www.cnn.com">CNN</a>
-
<input type="button" onclick="FindLink()" value="Find link">
-
-
<input type="text" name="URLNM" value="Test">Test Field</input>
-
</form>
-