양식 알림을받을 수있는 자습서 나 스크립트를 아는 사람이 있는지 궁금합니다.HTML 알림 알림 메시지
내가 원하는 것은 사람들이 특정 키워드를 양식에 입력 한 다음 메시지가 필요하다는 것입니다.
내가하고 싶은 일은 시청자가 다음 키워드를 양식에 입력 할 때입니다.
Medlab Central
Medlab Wanganui
Naylor Lawrence
Doughboys Bakery Limited – owners surname ‘Funke’
Denver Stockfeeds Limited – owners surname ‘Currie’
Midland Civil Limited – Miles and Vicky Worsley
Arran Trust – Stephen and Mary Barr
Roadmarking Services Limited – Karen and Kelly halligan
Steeds Pharmacy Ltd
'관심이 상충 할 수 있습니다. Proa가 어떻게 도와 줄 수 있는지 기다려주세요. '
빠른 시일 내에 HTML을 올바르게 코딩 했습니까?
<script language="JavaScript">
var nav=navigator.appName;
var ns=(nav.indexOf("Netscape")!=-1);
if(ns){
if(document.layers){
document.captureEvents(Event.KEYPRESS);
document.onkeypress = cheat;
}
if(document.getElementById){
document.onkeypress = cheat;
}
}
else
{document.onkeypress = cheat;}
var SpecialWords = "here"
var SpecialLetter = 0;
var vcheat = false
function cheat(keyStroke)
{
var eventChooser = (ns)?keyStroke.which: event.keyCode;
var which = String.fromCharCode(eventChooser).toLowerCase();
if(which == SpecialWord.charAt(SpecialLetter)){
SpecialLetter++;
if (SpecialLetter == SpecialWord.length) alert("There may be a conflict of interest. Please wait to hear from PROA regarding how they can help")
}
else {SpecialLetter = 0;vcheat = false}
}
</script>
나는 작동하는 스크립트를 발견
<form id="theForm">
<input type="text" />
<input type="submit" value="Send Email">
</form>
</body>
<script>
var specialWords = ["hello", "goodbye"];
$(function(){
$('#theForm').on("change keyup", "input[type='text']", function(event){
var inputValue = $(this).val();
if($.inArray(inputValue, specialWords) > -1){
alert(inputValue + " is a special word!");
}
});
});
</script>
</html>
은 .. 그러나 나는 지금 여러 specialwords을 위해 일해야합니다. 나는 마크가 말한 것을하려고 노력했다.
var specialWords = ["hello", "goodbye"];
그러나 wouldnt는 일한다. 어떤 제안.
문제를 명확하게 정의하십시오. 어떤 메시지를 생각해 내고 싶습니까? 너는 무엇을 하려니? – AlphaMale
위 답변에서 jquery 코드를 사용하고 경고를받는 값과'specialWords' 배열을 변경할 수 없습니까? 아래의 코드는 아무 것도 추가하지 않는 것 같습니다. 실제로 어떤 경우에는 작동하지 않습니다. 사용자가 마우스 오른쪽 버튼으로 붙여 넣거나 입력 상자가 두 개 있습니다. –