AbidingDude
Programmer
Eons ago I wrote an app for the machine shop I worked in. Without getting into too much detail, it takes a metric measurement, and a category (H12, r6, c9, F10, etc), looks up the dimensions for that category, and gives the results in millimeters and inches.
I wrote it as an HTML form. The form gets passed to a CGI that I wrote in C. The CGI then produces an HTML file with a table with the results.
I'm learning a lot more JavaScript now, and I wanted to revisit the old project. I thought it might be a nice improvement to still have the form-like input fields, but have the table be dynamically produced below it instead of on a new page.
However, I still need a CGI because I need file I/O to get the results. This article was really helpful for me learning to use Javascript and CGI:
I only had to make a few minor changes to the CGI which now outputs JavaScript.
For testing purposes, I put the query string as part of the attribute:
It works. It produces the table, but obviously that's not too useful, so I deleted the 'src' attribute, and added a button to click that calls maketable():
But no table is being drawn and the script tag does not seem to be updated.
I wrote it as an HTML form. The form gets passed to a CGI that I wrote in C. The CGI then produces an HTML file with a table with the results.
I'm learning a lot more JavaScript now, and I wanted to revisit the old project. I thought it might be a nice improvement to still have the form-like input fields, but have the table be dynamically produced below it instead of on a new page.
However, I still need a CGI because I need file I/O to get the results. This article was really helpful for me learning to use Javascript and CGI:
I only had to make a few minor changes to the CGI which now outputs JavaScript.
For testing purposes, I put the query string as part of the attribute:
HTML:
<SCRIPT id="res" src="cgi-bin/pmlfcgi.exe?dimension=35.1&tol=H10"></SCRIPT>
It works. It produces the table, but obviously that's not too useful, so I deleted the 'src' attribute, and added a button to click that calls maketable():
JavaScript:
function maketable()
{
var x, attr;
x=document.getElementById("res");
attr=document.createAttribute("src");
attr.value="cgi-bin/pmlfcgi.exe?dimension=51.7&tol=H11";
x.setAttributeNode(attr);
}
But no table is being drawn and the script tag does not seem to be updated.