国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home Web Front-end CSS Tutorial A brief discussion on the difference between href=# and href=javascript:void(0)_Experience exchange

A brief discussion on the difference between href=# and href=javascript:void(0)_Experience exchange

May 16, 2016 pm 12:04 PM
href

#"包含了一個位置信息

默認(rèn)的錨點是#top 也就是網(wǎng)頁的上端

而javascript:void(0)? 僅僅表示一個死鏈接

這就是為什么有的時候頁面很長瀏覽鏈接明明是??墒翘鴦拥搅隧撌?/p>

而javascript:void(0) 則不是如此

所以調(diào)用腳本的時候最好用void(0)

或者

打開新窗口鏈接的幾種辦法

1.window.open('url')

2.用自定義函數(shù)

??????? <script><br>??????? function openWin(tag,obj)<br>??????? {<br>??????????? obj.target="_blank";<br>??????????? obj.href = "Web/Substation/Substation.aspx?stationno="+tag;<br>??????????? obj.click();<br>??????? }<br>??????? </script>

LINK_TEST

window.location.href=""

?

-------------------------------------------------------------------------------

?

如果是個# ,就會出現(xiàn)跳到頂部的情況,個人收藏的幾種解決方法:
1:
2:
3:
4:
5:(好像在FF中不能顯示)

-------------------------------------------------------------------------------

慎用JavaScript:void(0)

?

JavaScript中void是一個操作符,該操作符指定要計算一個表達(dá)式但是不返回值。
void 操作符用法格式如下:
1. javascript:void (expression)
2. javascript:void expression
expression是一個要計算的 JavaScript 標(biāo)準(zhǔn)的表達(dá)式。表達(dá)式外側(cè)的圓括號是可選的,但是寫上去是一個好習(xí)慣。我們可以使用 void 操作符指定超級鏈接。表達(dá)式會被計算但是不會在當(dāng)前文檔處裝入任何內(nèi)容。面的代碼創(chuàng)建了一個超級鏈接,當(dāng)用戶點擊以后不會發(fā)生任何事。當(dāng)用戶點擊鏈接時,void(0) 計算為 0,但在 JavaScript 上沒有任何效果。

單擊此處什么也不會發(fā)生

In other words, if you want to perform certain processing without refreshing the page as a whole, you can use void(0), but if you need to refresh the page, you need to be careful.

In fact, we can use . This sentence will perform a submit operation. So under what circumstances is void(0) used more often? Without refresh, of course it is Ajax. If you look at the Ajax web page, you will generally see a lot of void(0), :), so when using void(0) ), it’s best to think about whether this page needs to be refreshed as a whole.

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

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

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.

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

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1502
276
What do src and href mean? What do src and href mean? Aug 16, 2023 pm 05:00 PM

src and href are respectively, 1. src is the abbreviation of source, which is used to specify the path of external resources. It is usually used to embed external files, such as pictures, audios, videos, etc. The src attribute is generally used on img, script, iframe and other tags. ; 2. href is the abbreviation of hypertext reference, which is used to specify the path of the target resource of the hyperlink. It is usually used to link to external documents or other pages. The href attribute is generally used on tags such as a and link.

What request is sent by href and src? What request is sent by href and src? Aug 17, 2023 pm 02:20 PM

Get requests sent by href and src. Detailed description: 1. The href attribute is used to specify the target resource of the link. When referencing an external style sheet, it will send a GET request to obtain the CSS file. When referencing the document, it will send a GET request to obtain the specified HTML file. When referencing an image, it will send a GET request. To obtain the specified image file; 2. The src attribute is used to specify the URL of the embedded resource. When referencing the image, it will send a GET request to obtain the specified image file. When referencing the audio, it will send a GET request to obtain the specified audio file, etc. .

What is the difference between src and href? Find out quickly! What is the difference between src and href? Find out quickly! Jan 06, 2024 pm 09:09 PM

What is the difference between src and href? Find out quickly! In the process of web development, src and href are two commonly used attributes. Although they look similar, they actually have different uses and applicable scenarios. In this article, we’ll dive into the differences between src and href and explain them with concrete code examples. In HTML, src is an attribute used to specify an external resource to be embedded or referenced. It is usually used to reference image, audio, video or script files. Unlike this, href is a hyperlink

Learn the important details about the difference between src and href! Learn the important details about the difference between src and href! Jan 06, 2024 am 09:11 AM

The difference between src and href, details you must know! When writing HTML pages, we often encounter the two attributes src and href. They are both used to reference external resources, such as script files, style files, or images. Although their purposes are similar, there are some differences in their specific usage and details. First of all, the src (source) attribute is mainly used to embed external resources, such as pictures or scripts. It is used to specify the address of a resource and embed its content into the current document. And href(

What are src attributes and href attributes? What's the difference between them? What are src attributes and href attributes? What's the difference between them? Dec 28, 2023 pm 03:18 PM

What are src attributes and href attributes? What's the difference between them? In HTML, the src attribute and the href attribute are two commonly used attributes for referencing external resources. Although they are somewhat similar in functionality, there are some differences in usage and types of referenced resources. First, let's take a look at the src attribute. src is the abbreviation of source, which is mainly used to specify the address of embedding/referencing external resources. It can be applied to some tags such as <script>, <img>

What are the differences in functions and usage between the src attribute and the href attribute? What are the differences in functions and usage between the src attribute and the href attribute? Dec 28, 2023 am 08:20 AM

The src attribute and href attribute are commonly used attributes in HTML and are used to load external resources. Although they have similar purposes, there are some differences in usage and purpose. src attribute: The src attribute is used to specify external resources to be embedded in the document. It is mainly used to introduce external script files and media files into HTML documents. It can be used in the following situations: Introduce external JavaScript files: Link external JavaScript files to HTML pages through the src attribute.

What is the difference between src and href What is the difference between src and href Aug 17, 2023 pm 02:34 PM

The difference between src and href: 1. Different uses, src is used for resources embedded in the document, href is used to link to resources outside the document; 2. Different reference methods, the resources referenced by src are required, and the resources referenced by href It is optional; 3. The impact on the document is different, src will directly affect the loading and display of the document, href will only affect the use of referenced resources; 4. The scope of application is different, src is suitable for pictures, audios, videos and scripts For references to resources such as CSS, href applies to CSS style sheets, font files and web links.

What is the difference between src and href What is the difference between src and href Oct 16, 2023 am 11:15 AM

Both the src and href attributes are used to specify the address of the resource, but the purposes and usage scenarios are different: 1. The src attribute is used to specify the address of the external resource, while the href attribute is used to specify the target address of the hyperlink; 2. The src attribute is introduced It is used when media elements are used, and the href attribute is usually used in the <a> tag; 3. The src attribute tells the browser to load the specified resource and embed it into the current page, and the href attribute defines the web page to be opened after the user clicks , document, or other resource URL.

See all articles