내 코드가 jsfiddle에서 작동하지만 브라우저에서 작동하지 않습니다. 여기에 무엇을 놓쳤는지 알 수 없으므로 해결책을 알려주십시오. 내가 그것을 구글하지만 난이 올바른 해결책이 저를 도와주세요지고 있지 않다 이 jsfiddle은 onload
이벤트에 자동으로 싸서 http://jsfiddle.net/pLTrJ/9/javascript 코드가 jsfiddle에서 작동하지만 브라우저에서 작동하지 않습니다.
<!doctype html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"> </script>
</head>
<script type="text/javascript">
var random = 0;
var theDiv = document.getElementById("showVal");
updateTheDiv(9,0);
function updateTheDiv(inRange, inMin) {
random = (Math.random()*inRange+inMin)|0;
theDiv.innerHTML = random;
var nextCall = (Math.random()*1000)|0;
setTimeout(function() {
updateTheDiv(inRange, inMin);
}, nextCall);
}
</script>
<body>
<div id="showVal"></div>
</body>
</html>
콘솔에 오류가 있습니까? 예상되는 결과는 무엇입니까? – Andy
http://code.jquery.com/jquery-latest.min.js를 사용하지 마십시오. 항상 jquery 1.11.1을 참조합니다! 읽기 : http://stackoverflow.com/questions/441412/is-there-a-link-to-the-latest-jquery-library-on-google-apis – Refilon
@Andy는이 링크를 확인할 수 있습니다. http : // jsfiddle.net/pLTrJ/9/ – rizwan