UWInfo Blog
發表新文章
[Join] | [忘記密碼] | [Login]
搜尋

搜尋意見
文章分類-Doug
[所有文章分類]
  • ASP.NET (0)
  • ASP.NET2.0 (0)
  • ASP.NET4.0 (0)
  • JavaScript (5)
  • jQuery (3)
  • FireFox (0)
  • UW系統設定 (0)
  • SQL (0)
  • SQL 2008 (0)
  • mirror (0)
  • SVN (0)
  • IE (0)
  • IIS (0)
  • IIS6 (0)
  • 閒聊 (0)
  • W3C (0)
  • 作業系統 (0)
  • C# (0)
  • CSS (0)
  • FileServer (0)
  • HTML 5 (0)
  • CKEditor (0)
  • UW.dll (1)
  • Visual Studio (0)
  • Browser (0)
  • SEO (0)
  • Google Apps (0)
  • 網站輔助系統 (0)
  • DNS (0)
  • SMTP (0)
  • 網管 (0)
  • 社群API (0)
  • SSL (0)
  • App_Inventor (0)
  • URLRewrite (0)
  • 開發工具 (0)
  • JSON (0)
  • Excel2007 (0)
  • 試題 (0)
  • LINQ (0)
  • bootstrap (0)
  • Vue (0)
  • IIS7 (0)
  • foodpanda (0)
  • 編碼 (0)
  • 資安 (0)
  • Sourcetree (0)
  • MAUI (0)
  • CMD (0)
  • my sql (0)
所有文章分類
[Doug的分類]
  • ASP.NET (48)
  • ASP.NET2.0 (15)
  • ASP.NET4.0 (34)
  • JavaScript (49)
  • jQuery (26)
  • FireFox (4)
  • UW系統設定 (3)
  • SQL (39)
  • SQL 2008 (25)
  • mirror (4)
  • SVN (4)
  • IE (9)
  • IIS (20)
  • IIS6 (1)
  • 閒聊 (7)
  • W3C (6)
  • 作業系統 (9)
  • C# (24)
  • CSS (12)
  • FileServer (1)
  • HTML 5 (11)
  • CKEditor (3)
  • UW.dll (13)
  • Visual Studio (16)
  • Browser (8)
  • SEO (1)
  • Google Apps (3)
  • 網站輔助系統 (4)
  • DNS (5)
  • SMTP (4)
  • 網管 (11)
  • 社群API (3)
  • SSL (4)
  • App_Inventor (1)
  • URLRewrite (2)
  • 開發工具 (6)
  • JSON (1)
  • Excel2007 (1)
  • 試題 (3)
  • LINQ (1)
  • bootstrap (0)
  • Vue (3)
  • IIS7 (3)
  • foodpanda (2)
  • 編碼 (2)
  • 資安 (3)
  • Sourcetree (1)
  • MAUI (1)
  • CMD (1)
  • my sql (1)
最新回應
  • 尋找 Aspnet_regsql.exe 的正確版本
    1. 對資料庫建立相對應的cache tableaspnet_regsql.exe -ed -d E...more
  • 新增Common.popUp2,傳物件丟到Common.popUp
    把 12 個參數的名稱和預設值寫一下吧。...more
  • [程式提醒][VB.net]
    將此文章分類在 UW.dll...more
  • [程式提醒][VB.net]
    當進行"玩"物件Update指令之後 --> 玩 ??...more
  • [程式提醒][Ajax][html] jQuery 做 HTML本文做取代時要注意 Javascript
    "HAML" ?...more
  • [程式片段][前台]VB預設
    這一段是做什麼用的 ?...more
標籤
  • 54
  • 變更欄位
  • cookie
  • trigger
  • 100
  • en
  • [t],
  • asp
  • ef
  • core
  • 5456
  • RFP
  • 上傳
  • 22 ORDER B
  • AD
  • IIS
  • 894
  • C
  • web
  • unt
  • 具有潛在危險 req
  • .
  • 9160
  • certificat
  • FireFox
  • Cache
  • mod
  • 刪除
  • proxy
  • WebForms
  • .net frame
  • max
  • load
  • 401.3
  • 766
  • download
  • 12
  • Data[t]
  • bugzilla
  • Contains-t
  • lock
  • Image
  • regex
  • HTML
  • let
  • mssql 備份
  • mdnN6Bp9
  • code
  • 剪
  • -5846
搜尋 結果:
前端處理網址組網址工具
在後端部分,因為有uw元件,在處理url時已經很好處理了
但是在JavaScript因為我們沒有固定js在使用,
因此提供一套簡易使用網址處理工具
thisPage.ParameterByName(key) //取得網址上特定參數
thisPage.OriUrl(key) //中間一段提供修改變數的功能


    <script>
        var thisPage = {
            Init: function () {
                thisPage.InitPageInput();

                $("body")
                    ;
                thisPage.ChangeEvent();
            },
            ParameterByName: function (targetKey) {
                var res = null;
                const urlSearchParams = new URLSearchParams(window.location.search);
                const params = Object.fromEntries(urlSearchParams.entries());
                for (const [key, value] of Object.entries(params)) {
                    if (targetKey.trim().toLocaleLowerCase() === key) {
                        res = value;
                    }
                }
                return res;
            },
            OriUrl: function () {
                var arrayUrl = [];
                arrayUrl.push(window.location.protocol);//https:
                arrayUrl.push("//");
                arrayUrl.push(window.location.hostname);//blog.uwinfo.com.tw
                if (window.location.port.length > 0) {
                    //大多情況,不用特別指定port
                    arrayUrl.push(":");
                    arrayUrl.push(window.location.port);//80
                }
                arrayUrl.push(window.location.pathname);//post/Edit.aspx
                //換一套寫法
                //arrayUrl.push(window.location.search);//?Id=321
                const urlSearchParams = new URLSearchParams(window.location.search);
                const params = Object.fromEntries(urlSearchParams.entries());
                var ayyarQueryString = [];
                //這邊可以加工增加額外的key值
                for (const [key, value] of Object.entries(params)) {
                    if (value.trim().length > 0) {
                        //這邊要注意中文需要encode
                        ayyarQueryString.push(key + "=" + encodeURIComponent(value));
                    }
                }
                if (ayyarQueryString.length > 0) {
                    arrayUrl.push("?");
                    arrayUrl.push(ayyarQueryString.join('&'));
                }
                return arrayUrl.length > 0 ? arrayUrl.join('') : '';
            },
            InitPageInput: function () {
                const urlSearchParams = new URLSearchParams(window.location.search);
                const params = Object.fromEntries(urlSearchParams.entries());
                for (const [key, value] of Object.entries(params)) {
                    $('input[name=' + key + ']').val(value);
                    //這邊因為input有多種不同輸入方式,可以自行編輯
                    //$('select[name=' + key + ']').val(value);
                    //$('textarea[name=' + key + ']').html(value);
                }
            },
            ChangeEvent: function () {

            },
        }
        $(function () {
            thisPage.Init();
        });
    </script>
More...
Doug, 2021/10/1 下午 12:19:30
[小工具][JS] Unt 的 Message Box
popUp先前就已經有在使用了~
但是原本的功能只能輸入 Title 和 Message
並且版面上都很固定,例如有沒有確定按鈕、取消按鈕、是否要顯示Title的是固定的~
因此改出下列版本~
popUp: function (Title, Message, Width, Height, hasbtnclose, hasbtnOK, hasbtnCancel, fuclose, fuOK, fuCancel)

格式講解:
Title:不輸入或者輸入空字串,則不會顯示Title(p1)(p2)

Message:中間的文字
Width:可自行輸入,輸入0則表示使用預設值390,不建議自行調整會有瀏覽器版本問題。

Height:可自行輸入,輸入0則表示用預設,會自動拉開高度。
hasbtnclose:true / false

hasbtnOK:true / false

hasbtnCancel:true / false

fuclose, fuOK, fuCancel分別是指按鈕按下去之後要執行的onclick,切記,無法使用雙引號

文件參考位置
http://localhost:2874/WWW20/scripts/Merge/Common.js

darren 補充:
我改一下標題 讓大家比較清楚這篇文章的主旨
建議可以把 arguments 改成一般 options 物件寫法

// 例如
Common.popUp({
    Title: "....",
    Message: "......."
    .....
    onOKClick: function() {
        // handle onclick ok button event
    },
    onCancelClick: function() {
        // handle onclick cancel button event
    }
});








 


 
More...
Doug, 2014/2/27 上午 10:16:34
[程式提醒][JS][html] 判斷頁面上某物件是否存在的方式

//判斷頁面上某物件是否存在的方式~
var str = "Hello Morse";
if (document.getElementById('Create_Menu')){
    document.getElementById('Create_Menu').innerHTML = str;
}else{
}

相關文件
http://localhost:2874/WWW20/scripts/Merge/Create_Menu.js
More...
Doug, 2014/2/25 下午 03:26:56
[程式提醒][JS][html] jQuery .html(' long string...') 失敗問題

有時候會用html去取代物件裡的內容,但是當取代的文字過長的時候,很可能會沒有錯誤訊息,但是卻又無法正常顯示,尤其是IE8
var str = "過長的文字";
$(".asdasd").html();
此時我們最好使用以下的方式
var str = "過長的文字";
document.getElementById('Create_Menu').innerHTML = str;
就可以正常執行了
相關參考
http://localhost:2874/WWW20/scripts/Merge/Create_Menu.js


darren 補充:
調整一下標題,讓他較符合發文內容
More...
Doug, 2014/2/25 下午 03:23:27
[程式提醒][Ajax][html] jQuery 做 HTML本文做取代時要注意 Javascript
當使用Ajax做回應的時候~
有時候會將HTML本文做取代
例如:$(e).html(回應文)、$(e).replaceWith(回應文)
但是回應文中若是包含Javascript可能會執行,但是並不會顯示在Html裡面
注意:會執行、但不一定會顯示
More...
Doug, 2014/1/10 上午 10:45:00
~ Uwinfo ~