2017-04-06 114 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();