oc1ober Posted March 3, 2021 Share Posted March 3, 2021 Hi guys, I am having problems using dynamic data list, It doesn't work when I insert a form into Blogspot, how should I fix it? <html> <head> </head> <body contenteditable="false"> <script> function populate(Ts7, Ts8){ var Ts7 = document.getElementById(Ts7); var Ts8 = document.getElementById(Ts8); Ts8.innerHTML = ""; if(Ts7.value == "Phòng kế hoạch"){ var optionArray = ["|","|Phòng kế hoạch"]; } else if(Ts7.value == "Bản"){ var optionArray = ["|","|Bản1","|Bản2","|Bản3"]; } else if(Ts7.value == "Huyện"){ var optionArray = ["|","|Huyện1","|Huyện2"]; } else if(Ts7.value == "Tỉnh"){ var optionArray = ["|","|Tỉnh1","|Tỉnh2"]; } else if(Ts7.value == "Trung ương"){ var optionArray = ["|","|Trung ương1","|Trung ương2"]; } for(var option in optionArray){ var pair = optionArray[option].split("|"); var newOption = document.createElement("option"); newOption.value = pair[0]; newOption.innerHTML = pair[1]; Ts8.options.add(newOption); } } </script> <p>1. Cấp</p> <select name="entry.694698089" id="Ts7" required="" onchange="populate(this.id,'Ts8')"> <option value="">Chọn</option> <option value="Phòng kế hoạch">Phòng kế hoạch</option> <option value="Bản">Bản</option> <option value="Huyện">Huyện</option> <option value="Tỉnh">Tỉnh</option> <option value="Trung ương">Trung ương</option> </select> <p>2. Nội dung</p> <select id="Ts8" name="entry.1049020395" required=""></select> </body> </html> bandicam 2021-03-03 16-25-54-648.mp4 Link to comment Share on other sites More sharing options...
Ingolme Posted March 3, 2021 Share Posted March 3, 2021 My first guess is that BlogSpot removes <script> tags from the content of the document. If that is not the cause of the problem, then maybe there is a Javascript error. In most browsers you can see Javascript errors by pressing F12. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now