search
HomeBackend DevelopmentPHP TutorialWill this be the only way to do it in the morning from now on - jQuery, in the morning - jquery_PHP tutorial

以后上午就只能这样了么-jQuery,上午么-jquery

  hi

昨天睡得不错

为什么早上还是看不进论文,宁愿做这个,也不愿认真看论文。感觉上还是下午看论文感觉要好的多。不过最近有三十多篇要看哇。。。管球。。。

1、jQuery

-----jQuery常用插件-----

----表单插件——form

通过表单form插件,调用ajaxForm()方法,实现ajax方式向服务器提交表单数据,并通过方法中的options对象获取服务器返回数据,调用格式如下:

<strong>$(form). ajaxForm ({options})</strong>

其中form参数表示表单元素名称;options是一个配置对象,用于在发送ajax请求过程,设置发送时的数据和参数。





个人信息页





用户名:



昵称:








----图片灯箱插件——lightBox

该插件可以用圆角的方式展示选择中的图片,使用按钮查看上下张图片,在加载图片时自带进度条,还能以自动播放的方式浏览图片,调用格式如下:

<strong>$(linkimage).lightBox({options})</strong>

其中linkimage参数为包含图片的元素名称,options为插件方法的配置对象。




我的相册





----图片放大镜插件——jqzoom

在调用jqzoom图片放大镜插件时,需要准备一大一小两张一样的图片,在页面中显示小图片,当鼠标在小图片中移动时,调用该插件的jqzoom()方法,显示与小图片相同的大图片区域,从而实现放大镜的效果,调用格式如下:

<strong>$(linkimage).jqzoom({options})</strong>

其中linkimage参数为包含图片的元素名称,options为插件方法的配置对象。




图片放大镜





----cookie插件——cookie

使用cookie插件后,可以很方便地通过cookie对象保存、读取、删除用户的信息,还能通过cookie插件保存用户的浏览记录,它的调用格式为:

保存:<strong>$.cookie(key</strong><strong>,</strong><strong>value)</strong>;读取:<strong>$.cookie(key)</strong>,删除:<strong>$.cookie(key</strong><strong>,</strong><strong>null)</strong>

其中参数key为保存cookie对象的名称,value为名称对应的cookie值。




cookie插件





邮箱:



是否保存邮箱




----搜索插件——autocomplete

搜索插件的功能是通过插件的autocomplete()方法与文本框相绑定,当文本框输入字符时,绑定后的插件将返回与字符相近的字符串提示选择,调用格式如下:

<strong>$(textbox).autocomplete(urlData,[options]);</strong>

其中,textbox参数为文本框元素名称,urlData为插件返回的相近字符串数据,可选项参数options为调用插件方法时的配置对象。




搜索插件


用户名








----右键菜单插件——contextmenu

右键菜单插件可以绑定页面中的任意元素,绑定后,选中元素,点击右键,便通过该插件弹出一个快捷菜单,点击菜单各项名称执行相应操作,调用代码如下:

<strong>$(selector).contextMenu(menuId,{options});</strong>

Selector参数为绑定插件的元素,meunId为快捷菜单元素,options为配置对象。



点击右键







  • 保存

  • 退出






----自定义对象级插件——lifocuscolor插件

自定义的lifocuscolor插件可以在

    元素中,鼠标在表项
  • 元素移动时,自定义其获取焦点时的背景色,即定义
  • 元素选中时的背景色,调用格式为:

    <strong>$(Id).focusColor(color)</strong>

    其中,参数Id表示

      元素的Id号,color表示
    • 元素选中时的背景色。




      对象级别的插件



      • 橘子水果

      • 芹菜蔬菜

      • 香蕉水果






      ----自定义类级别插件—— twoaddresult

      通过调用自定义插件twoaddresult中的不同方法,可以实现对两个数值进行相加和相减的运算,导入插件后,调用格式分别为:

      <strong>$.addNum(p1,p2) </strong><strong> $.subNum(p1,p2)</strong>

      上述调用格式分别为计算两数值相加和相减的结果,p1和p2为任意数值。




      自定义类级别插件





      两数相减:

      -

      =





      2. MySQL&PHP

      -----php built-in MySQL function (1)-----

      ----Connect to database

      mysql_connect

      mysql_connect('localhost','root','');

      That is to say, this function has 3 parameters, database name or IP address, username, password

      Note that it is generally believed that mysql_connect will no longer be supported in future versions (it seems that versions after php5.5) can be replaced by mysqi_connect

      if(mysqli_connect('localhost','root','')){
      echo "Connection successful";

      }else{
      echo "shit";
      }

      The test code is as above

      After the connection is successful, the mysql connection identifier will be returned (the use will be mentioned below); if it fails, false will be returned

      ---Database extension

      A database in PHP may have one or more extensions, including official ones and those provided by third parties. Commonly used extensions for Mysql include the native mysql library, you can also use the enhanced mysqli extension, and you can also use PDO for connection and operation.

      Different extensions provide basically similar operation methods. The difference is that they may have some new features and the operation performance may be different.

      Mysql extension method for database connection:

      $link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password');

      mysqli extension:

      $link = mysqli_connect('mysql_host', 'mysql_user', 'mysql_password');

      PDO extension

      $dsn = 'mysql:dbname=testdb;host=127.0.0.1';
      $user = 'dbuser';
      $password = 'dbpass';
      $dbh = new PDO($dsn, $user, $password);

      ----Close database connection

      mysql_close

      mysql_close($con); Close the previous connection, where $con is the identifier returned after mysql_connect() succeeds

      $con=mysqli_connect('localhost','root','','info');

      ----Select database

      mysql_select_db()

      $con=mysqli_connect('localhost','root','','info');
      if($con){
      echo "Connection successful";
      }else{
      echo "shit";
      }
      //mysql_close($con);
      if(mysqli_select_db($con, 'info')){
      echo "Success ";
      }else{
      echo "shit";
      }

      Since my PHP version is relatively high, mysql basically doesn’t recognize it, so I switched to mysqli. However, the basic usage is similar, but I need to pay attention to the parameters. Generally speaking, the compilation software (I use Zend) has prompts, so don’t worry

      ----Execute SQL statement

      mysqli_query()

      mysqli_query($con, "INSERT test(name) VALUES('Tom')");

      mysqli requires connection, $con

      ---Execute MySQL query

      After establishing a connection to the database, you can query, using the form of mysql_query plus sql statement to send query instructions to the database.

      $res = mysql_query('select * from user limit 1');

      For query class statements, a resource handle (resource) will be returned, and the data in the query result set can be obtained through this resource.

      $row = mysql_fetch_array($res);
      var_dump($row);

      By default, PHP uses the nearest database connection to execute the query, but if there are multiple connections, you can query from that connection through the parameter command.

      $link1 = mysql_connect('127.0.0.1', 'code1', '');
      $link2 = mysql_connect('127.0.0.1', 'code1', '', true); //开启一个新的连接
      $res = mysql_query('select * from user limit 1', $link1); //从第一个连接中查询数据

      //Connect to the database
      mysql_connect('127.0.0.1', 'code1', '');
      mysql_select_db('code1');
      mysql_query("set names 'utf8'");
      //Perform data query here
      $res = mysql_query("select * from user limit 1");

      $row = mysql_fetch_array($res);

      var_dump($row);

      ---Insert new data into MySQL

      After we understand how to use mysql_query for data query, similarly, inserting data is actually achieved by executing a sql statement, for example:

      $sql = "insert into user(name, age, class) values('李四', 18, '高三一班')";
      mysql_query($sql); //执行插入语句

      Usually data is stored in variables or arrays, so the sql statement needs to be string spliced ​​first.

      $name = '李四';
      $age = 18;
      $class = '高三一班';
      $sql = "insert into user(name, age, class) values('$name', '$age', '$class')";
      mysql_query($sql); //执行插入语句

      In mysql, after executing the insert statement, you can get the auto-incremented primary key id, which can be obtained through PHP's mysql_insert_id function.

      $uid = mysql_insert_id();

      This ID is very useful. It can usually be used to determine whether the insertion is successful, or as an associated ID for other data operations.

      //Connect to the database
      mysql_connect('127.0.0.1', 'code1', '');
      mysql_select_db('code1');
      mysql_query("set names 'utf8'");
      //The known data variables are
      $name = '李思';
      $age = 18;
      $class = 'Class 1, Grade 3';
      //Perform data query here
      $sql="insert into user(name,age,class) value ('$name','$age','$class')";
      mysql_query ($sql);
      $uid=mysql_insert_id();
      print_r($uid);

      I’m going back to watch the Chinese team’s game and will continue tomorrow

      www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1072327.htmlTechArticle From now on, will this be the only way in the morning - jQuery, in the morning - jquery hi I slept well yesterday, why do I still watch it in the morning? If I don’t get into the paper, I would rather do this than read the paper seriously. Does it feel up or down...
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
jquery实现多少秒后隐藏图片jquery实现多少秒后隐藏图片Apr 20, 2022 pm 05:33 PM

实现方法:1、用“$("img").delay(毫秒数).fadeOut()”语句,delay()设置延迟秒数;2、用“setTimeout(function(){ $("img").hide(); },毫秒值);”语句,通过定时器来延迟。

axios与jquery的区别是什么axios与jquery的区别是什么Apr 20, 2022 pm 06:18 PM

区别:1、axios是一个异步请求框架,用于封装底层的XMLHttpRequest,而jquery是一个JavaScript库,只是顺便封装了dom操作;2、axios是基于承诺对象的,可以用承诺对象中的方法,而jquery不基于承诺对象。

jquery怎么修改min-height样式jquery怎么修改min-height样式Apr 20, 2022 pm 12:19 PM

修改方法:1、用css()设置新样式,语法“$(元素).css("min-height","新值")”;2、用attr(),通过设置style属性来添加新样式,语法“$(元素).attr("style","min-height:新值")”。

jquery怎么在body中增加元素jquery怎么在body中增加元素Apr 22, 2022 am 11:13 AM

增加元素的方法:1、用append(),语法“$("body").append(新元素)”,可向body内部的末尾处增加元素;2、用prepend(),语法“$("body").prepend(新元素)”,可向body内部的开始处增加元素。

jquery怎么删除div内所有子元素jquery怎么删除div内所有子元素Apr 21, 2022 pm 07:08 PM

删除方法:1、用empty(),语法“$("div").empty();”,可删除所有子节点和内容;2、用children()和remove(),语法“$("div").children().remove();”,只删除子元素,不删除内容。

jquery中apply()方法怎么用jquery中apply()方法怎么用Apr 24, 2022 pm 05:35 PM

在jquery中,apply()方法用于改变this指向,使用另一个对象替换当前对象,是应用某一对象的一个方法,语法为“apply(thisobj,[argarray])”;参数argarray表示的是以数组的形式进行传递。

jquery怎么去掉只读属性jquery怎么去掉只读属性Apr 20, 2022 pm 07:55 PM

去掉方法:1、用“$(selector).removeAttr("readonly")”语句删除readonly属性;2、用“$(selector).attr("readonly",false)”将readonly属性的值设置为false。

jquery on()有几个参数jquery on()有几个参数Apr 21, 2022 am 11:29 AM

on()方法有4个参数:1、第一个参数不可省略,规定要从被选元素添加的一个或多个事件或命名空间;2、第二个参数可省略,规定元素的事件处理程序;3、第三个参数可省略,规定传递到函数的额外数据;4、第四个参数可省略,规定当事件发生时运行的函数。

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

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),