Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize the function of exporting or downloading files in modal form by WEB

Shulou Source: shulou.com Published: 2022-06-03 05:57:24 11月17日 Update

This article mainly introduces WEB in the modal form how to achieve export or download file function, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

The code is as follows:

My chat transcript

$(document) .ready (function () {

$('a [href] [hrefraction = "#"]') .click (function () {

SetSelfTarget (this)

});

$('input') .click (function () {

SetSelfTarget (this)

});

});

Function SetTarget () {

Var htmTarget = document.getElementsByTagName ("head")

If ((undefined! = htmTarget) & & (0 < htmTarget.length)) {

Var b = htmTarget [0] .getElementsByTagName ("base")

If ((undefined! = b) & & (0 < b.length)) {

B [0] .target = "download"

}

}

}

Function SetSelfTarget (obj) {

If (obj.id! = "btn_Export") {

Var htmTarget = document.getElementsByTagName ("head")

If ((undefined! = htmTarget) & & (0 < htmTarget.length)) {

Var b = htmTarget [0] .getElementsByTagName ("base")

If ((undefined! = b) & & (0 < b.length))

B [0] .target = "_ self"

}

}

}

Thank you for reading this article carefully. I hope the article "how to export or download files in WEB in modal forms" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Articles functions documents modes forms code value interests at the same time more friends knowledge editing chat notes industry information information channels channels references learning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Xiaomi Linux Huawei MariaDB