search
HomeWeb Front-endHTML Tutorial用户注册提交如何进行前后端交互,我是新手做前端的不懂后端的,该如何改代码让它可以交互!急用_html/css_WEB-ITnose


    

非专利微信平台交流会签到


    【地点】:南京市
    2016年01月14日
    

    

        
        
    

    

输入不得为空。


    

        
        
    

    

输入不得为空。


        

        
        
    

    

输入不得为空。


    

        
        
    

输入不得为空。


    

        

    

<script> <br /> // 1. 获取省份列表,绑定onchange事件 <br /> var provinceElement = document.getElementById("province1"); <br /> provinceElement.onchange = function(){ <br /> // 清空城市列表 <br /> var cityElement = document.getElementById("city"); <br /> var opts = cityElement.getElementsByTagName("option"); <br /> for(var z=1;z<opts.length;z++){ <br /> cityElement.removeChild(opts[z]); <br /> z--; <br /> } <br /> var provinceValue = provinceElement.value; <br /> var cities; <br /> switch (provinceValue){ <br /> case "北京": <br /> cities = ['北京']; <br /> break; <br /> case "天津": <br /> cities = ['天津']; <br /> break; <br /> case "上海": <br /> cities = ['上海']; <br /> break; <br /> case "重庆": <br /> cities = ['重庆']; <br /> break; <br /> case "深圳": <br /> cities = ['深圳']; <br /> break; <br /> case "广东": <br /> cities = ['广州','珠海','中山','佛山','东莞','清远','肇庆','阳江','湛江','韶关','惠州','河源','汕尾','汕头','梅州']; <br /> break; <br /> case "河北": <br /> cities = ['石家庄','唐山','秦皇岛','邯郸','邢台','张家口','承德','廊坊','沧州','保定','衡水']; <br /> break; <br /> case "山西": <br /> cities = ['太原','大同','阳泉','朔州','长治','临汾','晋城']; <br /> break; <br /> case "内蒙古": <br /> cities = ['呼和浩特','包头','乌海','临河','东胜','集宁','锡林浩特','通辽','赤峰','海拉尔','乌兰浩特']; <br /> break; <br /> case "辽宁": <br /> cities = ['沈阳','大连','鞍山','锦州','丹东','盘锦','铁岭','抚顺','营口','辽阳','阜新','本溪','朝阳','葫芦岛']; <br /> break; <br /> case "吉林": <br /> cities = ['长春','吉林','四平','辽源','通化','白山','松原','白城','延边']; <br /> break; <br /> case "黑龙江": <br /> cities = ['哈尔滨','齐齐哈尔','牡丹江','佳木斯','大庆','伊春','黑河','鸡西','鹤岗','双鸭山','七台河','绥化','大兴安岭']; <br /> break; <br /> case "江苏": <br /> cities = ['南京','苏州','无锡','常州','镇江','连云港 ','扬州','徐州 ','南通','盐城','淮阴','泰州','宿迁']; <br /> break; <br /> case "浙江": <br /> cities = ['杭州','湖州','丽水','温州','绍兴','舟山','嘉兴','金华','台州','衢州','宁波']; <br /> break; <br /> case "安徽": <br /> cities = ['合肥 ','芜湖 ','蚌埠 ','滁州 ','安庆 ','六安 ','黄山 ','宣城 ','淮南 ','宿州 ','马鞍山 ','铜陵','淮北 ','阜阳 ','池州 ','巢湖 ','亳州']; <br /> break; <br /> case "福建": <br /> cities = ['福州 ','厦门 ','泉州 ','漳州 ','龙岩 ','南平 ','宁德 ','莆田 ','三明']; <br /> break; <br /> case "江西": <br /> cities = ['南昌','景德镇','九江','萍乡','新余','鹰潭','赣州','宜春','吉安','上饶','抚州']; <br /> break; <br /> case "山东": <br /> cities = ['济南','青岛','淄博','德州','烟台','潍坊','济宁','泰安','临沂','菏泽','威海','枣庄','日照','莱芜','聊城','滨州','东营']; <br /> break; <br /> case "河南": <br /> cities = ['郑州','开封','洛阳','平顶山','安阳','鹤壁','新乡','焦作','濮阳','许昌','漯河','三门峡','南阳','商丘','周口','驻马店','信阳','济源']; <br /> break; <br /> case "湖北": <br /> cities = ['武汉','黄石','十堰','荆州','宜昌','襄樊','鄂州','荆门','孝感','黄冈','咸宁','恩施','随州','仙桃','天门','潜江','神农架']; <br /> break; <br /> case "湖南": <br /> cities = ['长沙','株州','湘潭','衡阳','邵阳','岳阳','常德','郴州','益阳','永州','怀化','娄底','湘西 ']; <br /> break; <br /> case "广西": <br /> cities = ['南宁','柳州','桂林','梧州','北海','防城港','钦州','贵港','玉林','贺州','百色','河池']; <br /> break; <br /> case "海南": <br /> cities = ['海口 ','三亚','通什','琼海','琼山','文昌','万宁','东方','儋州']; <br /> break; <br /> case "四川": <br /> cities = ['成都','自贡','攀枝花','泸州','德阳','绵阳','广元','遂宁','内江','乐山','南充 ','宜宾','广安','达川','巴中','雅安','眉山 ','阿坝 ','甘孜 ','凉山 ']; <br /> break; <br /> case "贵州": <br /> cities = ['贵阳 ','六盘水','遵义','铜仁','毕节','安顺','黔西南 ','黔东南','黔南']; <br /> break; <br /> case "云南": <br /> cities = ['昆明','东川','曲靖','玉溪','昭通','思茅','临沧','保山','丽江','文山 ','红河 ','西双版纳 ','楚雄 ','大理 ','德宏 ','怒江','迪庆']; <br /> break; <br /> case "西藏": <br /> cities = ['拉萨','那曲','昌都','山南','日喀则','阿里','林芝']; <br /> break; <br /> case "陕西": <br /> cities = ['西安','铜川','宝鸡','咸阳','渭南','延安','汉中','榆林','商洛','安康']; <br /> break; <br /> case "甘肃": <br /> cities = ['兰州','金昌','白银','天水','嘉峪关','定西','平凉','庆阳','陇南','武威','张掖','酒泉','甘南 ','临夏']; <br /> break; <br /> case "青海": <br /> cities = ['西宁','海东',' 海北 ','黄南','海南','果洛','玉树','海西']; <br /> break; <br /> case "宁夏": <br /> cities = ['银川','石嘴山','银南','固原']; <br /> break; <br /> case "新疆": <br /> cities = ['乌鲁木齐','克拉玛依','石河子','吐鲁番','哈密','和田','阿克苏','喀什','克孜勒苏','巴音郭楞','昌吉','博尔塔拉','伊犁']; <br /> break; <br /> case "香港": <br /> cities = ['香港']; <br /> break; <br /> case "澳门": <br /> cities = ['澳门']; <br /> break; <br /> case "台湾": <br /> cities = ['台湾']; <br /> break; <br /> } <br /> for(var i=0;i<cities.length;i++){ <br /> var cityValue = cities[i]; <br /> var option = document.createElement("option"); <br /> var textNode = document.createTextNode(cityValue); <br /> option.appendChild(textNode); <br /> cityElement.appendChild(option); <br /> } <br /> } <br /> </script>

输入不得为空。


    

        

    

 

输入不得为空。


        

        
        
    

    

输入不得为空。


        




<script></script>



<script> <br /> function link(){ <br /> var name = $('#name input').val(); <br /> var danwei = $('#danwei input').val(); <br /> var bumen = $('#bumen input').val(); <br /> var phone = $('#phone input').val(); <br /> if(name=="" || danwei=="" || bumen == "" || phone==""){ <br /> alert('签到信息未完善!') <br /> } <br /> else{ <br /> alert('签到成功!'); <br /> window.location.href='check-in.html'; <br /> } <br /> } <br /></script>

<script></script>
<script> <br /> !window.jQuery&&document.write('<script src="js/jquery.min.js"><\/script>'); <br /></script>
<script></script>

<script> <br /> // 这个脚本是 ie6和ie7 通用的脚本 <br /> function custom_close(){ <br /> if <br /> (confirm("您确定要关闭本页吗?")){ <br /> window.opener=null; <br /> window.open('','_self'); <br /> window.close(); <br /> } <br /> else{} <br /> } <br /></script>


回复讨论(解决方案)

省份信息应该从数据库读取,不要写死,这样会使网页打开变慢。可以通过表单提交,也可以通过javascript发出ajax请求来与后台交互。当然,后台要有相应的处理程序来对你的请求做出响应。

可以把我的代码改成你说的方式发给我吗,我不会改!

前端取数据组装成页面,再将新数据返回给后端。。。。交互使用ajax就可以 了。

Statement
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
What is the root tag in an HTML document?What is the root tag in an HTML document?Apr 29, 2025 am 12:10 AM

TheroottaginanHTMLdocumentis.Itservesasthetop-levelelementthatencapsulatesallothercontent,ensuringproperdocumentstructureandbrowserparsing.

Are the HTML tags and elements the same thing?Are the HTML tags and elements the same thing?Apr 28, 2025 pm 05:44 PM

The article explains that HTML tags are syntax markers used to define elements, while elements are complete units including tags and content. They work together to structure webpages.Character count: 159

What is the significance of <head> and <body> tag in HTML?What is the significance of <head> and <body> tag in HTML?Apr 28, 2025 pm 05:43 PM

The article discusses the roles of <head> and <body> tags in HTML, their impact on user experience, and SEO implications. Proper structuring enhances website functionality and search engine optimization.

What is the difference between <strong>, <b> tags and <em>, <i> tags?What is the difference between <strong>, <b> tags and <em>, <i> tags?Apr 28, 2025 pm 05:42 PM

The article discusses the differences between HTML tags , , , and , focusing on their semantic vs. presentational uses and their impact on SEO and accessibility.

Please explain how to indicate the character set being used by a document in HTML?Please explain how to indicate the character set being used by a document in HTML?Apr 28, 2025 pm 05:41 PM

Article discusses specifying character encoding in HTML, focusing on UTF-8. Main issue: ensuring correct display of text, preventing garbled characters, and enhancing SEO and accessibility.

What are the various formatting tags in HTML?What are the various formatting tags in HTML?Apr 28, 2025 pm 05:39 PM

The article discusses various HTML formatting tags used for structuring and styling web content, emphasizing their effects on text appearance and the importance of semantic tags for accessibility and SEO.

What is the difference between the 'id' attribute and the 'class' attribute of HTML elements?What is the difference between the 'id' attribute and the 'class' attribute of HTML elements?Apr 28, 2025 pm 05:39 PM

The article discusses the differences between HTML's 'id' and 'class' attributes, focusing on their uniqueness, purpose, CSS syntax, and specificity. It explains how their use impacts webpage styling and functionality, and provides best practices for

What is the 'class' attribute in HTML?What is the 'class' attribute in HTML?Apr 28, 2025 pm 05:37 PM

The article explains the HTML 'class' attribute's role in grouping elements for styling and JavaScript manipulation, contrasting it with the unique 'id' attribute.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.