php - Using JavaScript to Modify a Page on the Fly based on <select> contents -
So, I've got a form and a inside the form
option & gt;
selected), I have to change the contents of the form on the fly (i.e., before the user clicks anything).
For example, if the user selects the Photo upload
option, a file upload box will appear, and if they select text entry
, This file upload box will appear instead of a text box.
Thank you.
function swapDiv (index) {var html = ''; Assign html var based on the index {... // index; } Div.innerHTML = html; // div html html allocations} select.onchange = function () {swapDiv (this.selectedIndex); }
Comments
Post a Comment