html extracts common elements_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:04:50
Original
1085 people have browsed it

<html><body><table border="1"><td><select><option value ="0">好</option>		<option value ="1">较好</option></select></td><td><select><option value ="0">好</option>		<option value ="1">较好</option></select></td></table></body></html>
Copy after login

Now there are two columns, and the drop-down lists they use are the same. Can you write these two same drop-down lists into a universal form? Each td needs to call this universal select. Already?


Reply to discussion (solution)

You can use document.createElement("select");
This way to write a function
Specifically, you can google document.createElement, API

I don’t think there are any good improvements, it’s just ctl c, ctr v, and select has been used as an independent component, there is no What kind of integration is necessary

Moreover, if you use it as a form, it is not appropriate to put it universally here

At least I think what you call universal is just the reuse of data. It’s not select. If it’s just data, you can write a method to extract the drop-down options. When the page loads, just dynamically add the options to the select

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template