js

2011-01-11 3 views
2

에 의해 마우스의 커서를 바꿀 MS CRM 동역학 4.0, js를 사용하여에 js를 사용하여 커서를 변경하려고합니다. ajax를 사용하여 메소드를 호출 할 때 기다림으로서 마우스의 커서를 표시하려고합니다. 문서 .body.style.cursor = "wait"; 하지만 작동하지 않습니다 ... 어떻게해야합니까?js

+0

당신은 당신의 코드 중 하나를 게시 할 수 있습니까? 구문은 포함 된 한 줄로 된 것으로 보입니다. – elwyn

+0

그것과 같은 것 : function BaforeCallingAjaxMethod() {document.body.style.cursor = "wait"; CallAjaxMethodNow();} –

답변

4

당신이하고있는 일이 효과가 있습니다.

cursor이 모든 자손의 CSS에 설정된 경우 body의 커서 설정보다 우선합니다.

예 :http://jsfiddle.net/88272/

또한 I는 width100%에 본체 height 연신 알.


다른 요소를 덮어 쓰는 경우 가능한 해결책이 있습니다.

당신의 CSS를이 추가 :

body.isWaiting, body.isWaiting * { 
    cursor:wait !important; 
} 

는 ... 다음을 수행하십시오

document.body.className = 'isWaiting'; 

예 :http://jsfiddle.net/88272/3/

당신은 브라우저 호환성을 테스트해야합니다.


편집 :

당신이 서버 측에서 자신 만의 스타일 시트를 추가 할 수없는 것처럼, 당신이 대신 자바 스크립트를 통해 하나를 추가 할 수있는 소리입니다.

예 :http://jsfiddle.net/88272/4/

// string representation of stylesheet content 
var styles = 'body.isWaiting, body.isWaiting * {cursor:wait !important;}'; 

    // grab the <head> element 
var head = document.getElementsByTagName('head')[0]; 

    // create a new "style" element, and set up its properties/content 
var sheet = document.createElement('style'); 
sheet.setAttribute('media', 'all'); 
sheet.setAttribute('type', 'text/css'); 

if(sheet.styleSheet) { 
    sheet.styleSheet.cssText = styles; // For IE 
} else { 
    sheet.appendChild(document.createTextNode(styles)); 
} 

    // append the new <style> element to the <head> 
head.appendChild(sheet); 

    // give the <body> the class when it is needed 
document.body.className = 'isWaiting'; 
+0

아니요, ms crm dynamics 4.0의 사용자 지정 엔티티입니다. 현재는 다른 아이디어로 CSS를 삽입 할 수 없습니까? –

+0

@ 대니 : 자바 스크립트를 통해 스타일 시트를 주입 할 수 있습니까? – user113716

+0

내가 그걸 시도 할거야, 어떻게? –