For some reason, when I enter a value in the following script, the value of ISBN is always undefined. I'm not sure why this is the case. I have set the button to run the function onclick as well...
HTML:
<form id="frm1">
Book ISBN: <input type="text" name="fname"><br><br>
<input type="button" onclick="myFunction()" value=行きましょう!>
</form>
JavaScript
function myFunction() {
var isbn = document.getElementById("frm1").submit(); // Replace with ISBN / EISBN / ASIN of the book
alert("Starting!");
alert(isbn);
var api_key = "cf6f5fe91531a855495d77fc06dd9ada6f1fa1f7"; //Replace with the developer key (Submit the form to get a key)
//Optional Settings
var smiley = 'true'; // Change to false if do not want to show smiley with each review
var width = 700; // Width of the reviews iframe
var height = 400; // Height of the reviews iframe
var wf = document.createElement('script');
var host = "idreambooks.com";
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
'://' + host + '/reviews_widget.js?api_key=' + api_key + '&isbn=' + isbn +
'&smiley=' + smiley + '&width=' + width + '&height=' + height;
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
}
Is there anything I'm missing about how to get input values?