2013-02-04 2 views
-2
이 2 기록

, 그것은 잘못된 IE 하나, 및 웹킷 하나,IE 브라우저 내가 만들고 싶어 커서 위치

나는 텍스트 영역이

,이 ID가 "web_editor_con2" 가요를 얻을 수 내가 사진을 업로드하려고 할 때, 즉 잘 작동하도록 시도 할 수 있습니다 웹 편집기, 그것은 "<form action='./upload.php' method='post' target='file_frame' enctype="multipart/form-data"><iframe name="file_frame" style="display:none;"></iframe>"

upload.php로 코드

echo '<script> 
        if (parent.document.all) { 
        parent.document.getElementById("web_editor_con2").value += "[img=' . $this->conf['SITE'] . "/Public/upload/" . $newpic . '][/img]"; 
     }else { 
      var obj = parent.document.getElementById("web_editor_con2"); 
      var startPos = obj.selectionStart; 
      var endPos = obj.selectionEnd; 
      parent.document.getElementById("web_editor_con2").value = obj.value.substring(0, startPos) + "[img=' . $this->conf['SITE'] . "/Public/upload/" . $newpic . '][/img]" + obj.value.substring(endPos); 
     }</script>'; 

을 가지고 사용할 수 있습니까?

+0

커서 위치와의 링크는 어디에 있습니까? 그것은 명확하지 않다, 질문을 명확히하십시오. – sdespont

+0

그리고 잊지 마세요 : PHP => 나쁜 연습 – sdespont

+0

과 JS 코드를 쓰지 마세요 ~ 예를 들어 "12345"를 입력하면 123 [img = http : // www. xxxxxx.com/1.jpg] [/ img]45] 웹킷 브라우저에서 제대로 작동하지만, 할 수 없습니다. – youcle

답변

1

이 튜토리얼에서 (내가 테스트 한 것과) 크롬 및 EI 작동하는 jQuery를 튜토리얼

http://docs.jquery.com/Tutorials:Mouse_Position

예제 코드입니다 :

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> 
<script type="text/javascript"> 
jQuery(document).ready(function(){ 
    $(document).mousemove(function(e){ 
     $('#status').html(e.pageX +', '+ e.pageY); 
    }); 
}) 
</script> 

내가 희망이 도움이!

+0

괜찮 았으면, 좌표 (100,100)에서 '123455'문자열을 내보내려는 경우, 어떻게합니까 그것 – youcle

관련 문제