짧은 스크립트에서 간단한 자바 스크립트 버튼 (id="storeButton"
)을 사용하지 않으려 고 노력했습니다. 그 효과에 대한 인터넷에서 발견 된 구문의 모든 변형을 시도했지만 아무 소용이 없습니다. 저는 이것을 워드 프레스 페이지에서 실행하고 있습니다. 누군가 내 실수를 말해 줄 수 있습니까?왜 내 버튼을 비활성화 할 수 없습니까?
워드 프레스 페이지 : 문제가 보인다
<p style="text-align: center;">Welcome!</p>
<strong>What is this project, and why contribute?</strong>
text
<script src="/scripts/alert.js" type="text/javascript"></script>
<script src="/webcamjs/webcam.js" type="text/javascript"></script>
<script src="/scripts/take_snapshot.js" type="text/javascript"></script>
<div class="centre" id="my_camera" style="width:320px; height:240px;"></div>
<br>
<div id="freezeButton"></div>
<div id="storeButton"></div>
<br>
<div id="my_result"></div>
<script type="text/javascript">
<!--
ShowAlert();
webcamConfigure();
attach();
createFreezeButton();
disableBtn();
createStoreButton();
//-->
</script>
take_snapshot.js이 될
document.getElementById("storeButton").disabled = true;
: 당신은 "storeButton"라는 사업부를 해제하려고
function webcamConfigure(){
Webcam.set({
width: 320,
height: 240,
dest_width: 640,
dest_height: 480,
image_format: 'jpeg',
jpeg_quality: 100,
force_flash: true
});
}
function attach(){
Webcam.attach('#my_camera');
}
function createStoreButton(){
sendButton = document.createElement("input");
sendButton.type = "button";
sendButton.value = "Send snapshot!";
sendButton.onclick = function store(){
Webcam.snap(function(data_uri) {
document.getElementById('my_result').innerHTML = '<img src="'+data_uri+'"/>';
});
}
placeHolder = document.getElementById("storeButton");
placeHolder.appendChild(sendButton);
}
function disableBtn(){
document.getElementById("storeButton").disabled = true;
}
function createFreezeButton(){
myButton = document.createElement("input");
myButton.type = "button";
myButton.value = "Take snapshot!";
myButton.onclick = function freeze(){
if (myButton.value=="Take snapshot!") {
myButton.value = "Discard snapshot!";
Webcam.freeze();
//document.getElementById("storeButton").disabled = false;
}
else {
myButton.value = "Take snapshot!";
Webcam.unfreeze();
//document.getElementById("storeButton").disabled = true;
}
}
placeHolder2 = document.getElementById("freezeButton");
placeHolder2.appendChild(myButton);
}
나는 그것을 시도했다. 방금 재 시도했지만 여전히 아무 일도 일어나지 않습니다. 그래도 의견을 보내 주셔서 감사합니다! 이것이 WordPress와 관련이 있다면 궁금해하니 ?? – Raoul