2017-04-06 111 views
-1

當輸入值超出預期值時,我在輸入框中顯示錯誤驗證消息。在Javascript中創建超鏈接消息

示例 - 如果輸入值大於1000,則錯誤彈出窗口顯示 - 「要顯示的某些文本」。

messages:{ 
thisIsAnInputid:{ 
    number: 'some message', 
    min: 'some message', 
    max:'some message', 
    required:'some message **Need hyperlink here**' 
    }, 
    ... 
    ... } 

我在帶有輸入ID的javascript文件中顯示此消息,作爲消息規則。我只是想在這裏添加一個href,以便用戶可以單擊錯誤消息來重定向到另一個頁面。

感謝,

+2

請你的代碼添加到這個問題 –

+1

HTTPS你可以啓動此功能:// WWW。 google.com/search?q=show+hyperlink+in+alert – mplungjan

+0

'if(confirm(「Input value is more than 1000 \ n您是否希望看到更多關於錯誤原因的信息?))location.replace(」 errormessage_morethan1000.h TML「);' – mplungjan

回答

0

如果輸入的值大於1000

function Alert() 
 
{ 
 
    var answer = confirm("Click ok to visit link.") // If they click okay, they visit the link. 
 
    if (answer) 
 
    { 
 
     window.location = "http://stackoverflow.com/questions/43251325/create-hyperlink-in-javascrip-in-message/43251588#43251588"; // Change link here. 
 
    } 
 
} 
 

 
Alert();