Hongmu Notes
Home Language Notes JavaScript

JavaScript

Introduction: js generally refers to JavaScript. JavaScript ("JS" for short) is a lightweight, interpreted or just-in-time compiled programming language with function priority. Although it is famous as a scripting language for developing Web pages, it is also used in many non-browser environments. JavaScript is a dynamic scripting language based on prototype programming and multi-paradigm.

Web page playing music scrolling lyrics effect

Web page playing music scrolling lyrics effect Language Notes JavaScript

When the web page plays audio, you can use jQuery and HTML to achieve the scrolling effect of lyrics. The following is a simple implementation: HTML: <div id="lyrics"> <p data-time="0:00.00">Written by : doll</p> <p data-time="0:01.00"…
👁 188
After clicking to submit the form in Empire CMS, use js to combine the URL and redirect it

After clicking to submit the form in Empire CMS, use js to combine the URL and redirect it Program Notes Empire cms Language Notes JavaScript

Many times, the search link is too long and carries many parameters. We want to make pseudo-static modifications and also hope that the link can be accessed a second time. Original html code: 🔒 Hidden content: You can view it after logging in <form class="form-search" id="q-form" method="get"> <div class="input-…
👁 302
jquery gets the real height and width of the video content in the iframe frame and sets it

jquery gets the real height and width of the video content in the iframe frame and sets it Language Notes JavaScript

You can get the real height and width of the video content in the iframe frame through the following jQuery code: $(document).ready(function(){ var iframe = $('#yourIframeID').get(0); var iframeDoc = iframe.contentDocument |…
👁 275
jQuery click Ajax to submit data

jQuery click Ajax to submit data Language Notes JavaScript

The following is a simple click event, using jQuery to send an AJAX request and submit the data to the server, and display a pop-up window when the data is returned: $(document).ready(function() { $('button').click(function() { // Define the data to be submitted var data = { name: '…
👁 165
Add an onclick to the image img to refresh the image on click

Add an onclick to the image img to refresh the image on click Language Notes JavaScript

You can use the following code to add an onclick event to the image to refresh the image after it is clicked: <img src="your-image-url.jpg" onclick="this.src=this.src+'?'+new Date().getTime();" /> When the image is clicked, this code will be in the U...
👁 485
jQuery uses cookies to add special class attributes to the navigation column

jQuery uses cookies to add special class attributes to the navigation column Language Notes JavaScript

After jQuery clicks on the a tag in the specified box, it sets the link of the a tag into the cookie. When the page jumps, how to set the cookie link to be the same as the url link of the a tag, add attributes to the a tag, and the cookie only stores one. When other a tags in the box are clicked, the link directly replaces $(document).ready(function() { //...
👁 173
jQuery AJAX Tutorial: Integrating with Web Forms (Frontend + Backend PHP)

jQuery AJAX Tutorial: Integrating with Web Forms (Frontend + Backend PHP) Language Notes JavaScript

Communicating with the server is easy using jQuery's ajax functions, and the form can send data to the server. Using them together allows for dynamically loaded and more interactive web pages. Below is a simple tutorial showing how to use jQuery's ajax functions to send form data to the server. Introduce jQuery library Introduce jQuery library into the page so that you can use jQuery's aja...
👁 115
Form form, after clicking submit, if the submission is successful, a pop-up window will prompt that the submission is successful. After clicking, it will jump to a new page.

Form form, after clicking submit, if the submission is successful, a pop-up window will prompt that the submission is successful. After clicking, it will jump to a new page. Language Notes JavaScript

You can use JavaScript to achieve this functionality. The specific steps are as follows: Add a submit button to the form and add an event listener to it. Use the XMLHttpRequest object in the event listener to submit form data to the server. Check the status code returned by the server in the onreadystatechange event handler of the XMLHttpRequest object...
👁 1066
JavaScript close this page after three seconds

JavaScript close this page after three seconds Language Notes JavaScript

可以使用 JavaScript 中的 setTimeout() 函数来实现页面自动关闭的效果。 The following is a sample code: setTimeout(function() { window.close(); }, 3000); In this code, the setTimeout() function will call an anonymous function after 3 seconds, and the anonymous function will call...
👁 193
jquery click to jump to the top of the web page

jquery click to jump to the top of the web page Language Notes JavaScript

You can use jQuery to jump to the top of the web page after clicking on an element. The following is a simple implementation method: $(document).ready(function() { // Listen to the click event of the element $('#my-element').click(function() { // Scroll to the top $('html, body').an…
👁 205
1 2 3 4