There is an html file with tables, in front of each table you need to make a select with a choice (agreed, not agreed). In fact, he attached the code. I am wondering if it is possible to make changes in the html file and save them in the same file (that is, perform all actions on the client side) using javascript.

<form name="r1" action=""> <table border=1 width=730> <tr><td width=100>Четверг</td><td width=30>01</td><td width=80>08:49:57</td><td width=80>17:29:40</td><td width=220>опоздал на входе</td><td width=220></td></tr> <tr><td width=100>Пятница</td><td width=30>02</td><td width=80>08:49:14</td><td width=80>13:01:10</td><td width=220>опоздал на входе</td><td width=220>поспешил на выходе</td></tr> <tr><td bgcolor=red width=100>Суббота</td><td width=30>03</td><td width=80>&nbsp</td><td width=80>&nbsp</td><td width=220>&nbsp</td><td width=220>отсутствовал</td></tr> <tr><td bgcolor=red width=100>Воскресенье</td><td width=30>04</td><td width=80>&nbsp</td><td width=80>&nbsp</td><td width=220>&nbsp</td><td width=220>отсутствовал</td></tr> </table> <select name="t1"> <option value="0">Согласовано</option> <option value="1" >Не согласовано</option> </select> </form> 
  • javascript does not have access to the html file - Grundy
  • and in what ways can this problem be solved? - Eliot
  • Client only - no - Grundy
  • @Grundy, thanks. I will do then on php - Eliot

1 answer 1

I assume that this is a local file that is not being opened over HTTP.

And even so, it is not directly possible.

There is a kind of workaround: if all the scripts of the page are embedded directly into it, then the current state of the page can be given to the user as a downloadable file .

Quite fresh browsers, in combination with FileSaver.js , allow you to "download" the JS-line as a file. If without libraries, the process usually consists of assembling Blob from a string and offering to download it through window.saveAs .

This will not change the source file in any way , but will load the file with the new state to the user. So the source file can be distributed even from the server via HTTP, but to download the result back, you already need the server part or third-party channels.