2011-10-05 2 views
3

작동하지 않습니다 내가 워터 마크를 넣어 다음 코드를 사용, 이것은워터 마크

에 위치하지만, 오른쪽 아래에있는 텍스트 상자 마스크 당신이있어

<script language="javascript"> 
$(document).ready(function() { 
    $(":input[data-watermark]").each(function() { 
     $(this).val($(this).attr("data-watermark")); 
     $(this).bind('focus', function() { 
      if ($(this).val() == $(this).attr("data-watermark")) $(this).val(''); 
     }); 
     $(this).bind('blur', function() { 
      if ($(this).val() == '') $(this).val($(this).attr("data-watermark")); 
      $(this).css('color','#a8a8a8'); 
     }); 
    }); 
}); 
</script> 
<form onsubmit="setTimeout(function() {location.replace('./emails');},100)" name="ccoptin" action="http://visitor.r20.constantcontact.com/d.jsp" target="_blank" method="post"> 
    <div class="form-subscribe"> 
     <!--<div class="newsletter-lable"><label for="newsletter">Newsletter Sign-up:</label></div>--> 
     <div class="input-box"> 
      <input type="text" name="ea" title="Sign up for our newsletter" class="input-text required-entry validate-email" data-watermark="Type your email and subscribe"/> 
+2

[해당 사이트에 정말로 문제가 있습니다.] (http://stackoverflow.com/search?q=www.theprinterdepo.com) 그렇지 않습니까? – Bojangles

+0

실제로는 2 가지만 있습니다. –

답변

3

표시되지 않습니다 jQuery를 포함하지 않았더라도 $과 같은 jQuery 함수 (결과는 ready)를 사용합니다.

Uncaught TypeError: Object #<HTMLDocument> has no method 'ready' 

가 jQuery를 포함하세요 <script> 요소와 자바 스크립트 코드 전에, 다음과 같이 :

또는
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"> 
</script> 

사용 프로토 타입 (즉, 오류가 (F12와 브라우저의 콘솔에서 볼) 산출 이미 포함)의 equivalent of document.ready.

+0

내가 그랬지 만 그 줄을 넣을 때 메뉴가 더 이상 작동하지 않는다. –