js method to achieve form radio switching effect_javascript skills
The example in this article describes the method of using js to achieve the form Radio switching effect. Share it with everyone for your reference. The details are as follows:
Here we implement the Radio radio button switching effect in the form based on js. When a certain radio button is selected, the range will change together. I think everyone should save it. I couldn’t complain when I wanted to use it in the past. The name of this effect has been found now, and it is so simple to implement. There are some places to pay attention to, and get the label named myradio.
The screenshot of the running effect is as follows:
The online demo address is as follows:
http://demo.jb51.net/js/2015/js-table-radio-cha-codes/
The specific code is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>Radio切换效果</title> <style> *{margin:0;padding:0;} body{margin:50px;font-size:12px;color:#666;} li{list-style:none;} div{width:210px;} #tab1 ,#tab2{width:398px;height:34px;border:1px #cfedff solid;border-bottom:0;background:url(images/title.gif) repeat-x;} #tab1 ul ,#tab2 ul{margin:0;padding:0;} #tab1 li,#tab2 li{float:left;padding:0 30px;height:34px;line-height:34px;text-align:center;border-right:1px #ebf7ff solid;cursor:pointer;} #tab1 li.now,#tab2 li.now{color:#5299c4;background:#fff;font-weight:bold;} .tablist{width:378px;height:100px;padding:10px;font-size:14px;line-height:24px;border:1px #cfedff solid;border-top:0;display:none;} .block{display:block;} </style> </head> <body> <h1 id="Radio切换">Radio切换</h1> <style type="text/css"> fieldset{width:378px;border:1px #B0C0D1 solid;padding:10px;} legend{background:#B0C0D1;padding:4px 10px;color:#fff;} #c{margin-top:10px;} .c1,.c2{width:378px;line-height:20px;} .c1{color:#014CC9;} .c2{color:#7E6095;} h3{font-size:16px;padding:5px 0;} .red{color:#BD0A01;} </style> <script type="text/javascript"> function radioShow(){ var myradio=document.getElementsByName("myradio"); var div=document.getElementById("c").getElementsByTagName("div"); for(i=0;i<div.length;i++){ if(myradio[i].checked){ div[i].style.display="block"; } else{ div[i].style.display="none"; } } } </script> <form name="ck"> <fieldset> <legend>I'm Radio</legend> <h3 id="请选择">请选择:</h3> <label for="r1" class="red"><input name="myradio" id="r1" type="radio" value="" checked="checked" onclick="radioShow();" />XML教程</label> <label for="r2" class="red"><input name="myradio" id="r2" type="radio" value="" onclick="radioShow();" />浏览器脚本</label> <div id="c"> <div class="c1"> <label for="xml"><input name="c2" type="checkbox" id="xml" value="" />XML</label> <label for="dtd"><input name="c2" id="dtd" type="checkbox" value="" />DTD</label> <label for="xmldom"><input name="c2" id="xmldom" type="checkbox" value="" />XML DOM</label> <label for="xsl"><input name="c2" id="xsl" type="checkbox" value="" />XSL</label> <label for="xslt"><input name="c2" id="xslt" type="checkbox" value="" />XSLT</label> <label for="xslfo"><input name="c2" id="xslfo" type="checkbox" value="" />XSL-FO</label> <label for="xpath"><input name="c2" id="xpath" type="checkbox" value="" />XPath</label> <label for="xquery"><input name="c2" id="xquery" type="checkbox" value="" />XQuery</label> <label for="xlink"><input name="c2" id="xlink" type="checkbox" value="" />XLink </label> <label for="xpointer"><input name="c2" id="xpointer" type="checkbox" value="" />XPointer</label> <label for="schema"><input name="c2" id="schema" type="checkbox" value="" />Schema</label> <label for="xforms"><input name="c2" id="xforms" type="checkbox" value="" />XForms</label> </div> <div class="c2" style="display:none;"> <label for="js"><input name="c3" id="js" type="checkbox" value="" />JavaScript</label> <label for="hd"><input name="c3" id="hd" type="checkbox" value="" />HTML DOM</label> <label for="dhtml"><input name="c3" id="dhtml" type="checkbox" value="" />DHTML</label> <label for="vbs"><input name="c3" id="vbs" type="checkbox" value="" />VBScript</label> <label for="ajax"><input name="c3" id="ajax" type="checkbox" value="" />AJAX</label> <label for="e4x"><input name="c3" id="e4x" type="checkbox" value="" />E4X</label> <label for="wml"><input name="c3" id="wml" type="checkbox" value="" />WMLScript</label> </div> </div> </fieldset> </form> </body> </html>
I hope this article will be helpful to everyone’s JavaScript programming design.

The main difference between Python and JavaScript is the type system and application scenarios. 1. Python uses dynamic types, suitable for scientific computing and data analysis. 2. JavaScript adopts weak types and is widely used in front-end and full-stack development. The two have their own advantages in asynchronous programming and performance optimization, and should be decided according to project requirements when choosing.

Whether to choose Python or JavaScript depends on the project type: 1) Choose Python for data science and automation tasks; 2) Choose JavaScript for front-end and full-stack development. Python is favored for its powerful library in data processing and automation, while JavaScript is indispensable for its advantages in web interaction and full-stack development.

Python and JavaScript each have their own advantages, and the choice depends on project needs and personal preferences. 1. Python is easy to learn, with concise syntax, suitable for data science and back-end development, but has a slow execution speed. 2. JavaScript is everywhere in front-end development and has strong asynchronous programming capabilities. Node.js makes it suitable for full-stack development, but the syntax may be complex and error-prone.

JavaScriptisnotbuiltonCorC ;it'saninterpretedlanguagethatrunsonenginesoftenwritteninC .1)JavaScriptwasdesignedasalightweight,interpretedlanguageforwebbrowsers.2)EnginesevolvedfromsimpleinterpreterstoJITcompilers,typicallyinC ,improvingperformance.

JavaScript can be used for front-end and back-end development. The front-end enhances the user experience through DOM operations, and the back-end handles server tasks through Node.js. 1. Front-end example: Change the content of the web page text. 2. Backend example: Create a Node.js server.

Choosing Python or JavaScript should be based on career development, learning curve and ecosystem: 1) Career development: Python is suitable for data science and back-end development, while JavaScript is suitable for front-end and full-stack development. 2) Learning curve: Python syntax is concise and suitable for beginners; JavaScript syntax is flexible. 3) Ecosystem: Python has rich scientific computing libraries, and JavaScript has a powerful front-end framework.

The power of the JavaScript framework lies in simplifying development, improving user experience and application performance. When choosing a framework, consider: 1. Project size and complexity, 2. Team experience, 3. Ecosystem and community support.

Introduction I know you may find it strange, what exactly does JavaScript, C and browser have to do? They seem to be unrelated, but in fact, they play a very important role in modern web development. Today we will discuss the close connection between these three. Through this article, you will learn how JavaScript runs in the browser, the role of C in the browser engine, and how they work together to drive rendering and interaction of web pages. We all know the relationship between JavaScript and browser. JavaScript is the core language of front-end development. It runs directly in the browser, making web pages vivid and interesting. Have you ever wondered why JavaScr


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Atom editor mac version download
The most popular open source editor

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
