나는 여러 개의 테이블을 가지고 있고 그 테이블을 반복하는 옵션 드롭 다운이 있습니다. http://codepen.io/fernandob/pen/JEJRMW 코드를 테스트 할 때 모든 작동하지만 내 Wordpress 페이지에서 추가 할 때 실행되지 않습니다. 워드 프레스에서 나는 시각적 인 작곡가를 사용하고 텍스트 블록에서 텍스트 편집기를 통해 HTML 코드를 붙인다.Wordpress의 인라인 자바 스크립트
<script>
if (typeof suffixes !== "undefined") {
suffixes += ",1390152632";
} else {
suffixes = "1390152632";
}
function changeCurrency_1390152632() {
var idx = document.getElementById("id_selected_currency_1390152632").options.selectedIndex;
var currency = document.getElementById("id_selected_currency_1390152632").options[document.getElementById("id_selected_currency_1390152632").options.selectedIndex].value;
var currencies = ["EUR", "USD", "GBP"];
var i, j;
for (i = 0; i < 3; i++) {
var els = document.getElementsByClassName("currency_" + currencies[i]);
var cnt = els.length;
if (currency == currencies[i]) {
for (j = 0; j < cnt; j++) {
els[j].style.display = "block";
}
var a = suffixes.split(",");
for (j = 0; j < a.length; j++) {
document.getElementById("id_selected_currency_" + a[j]).options.selectedIndex = idx;
}
} else {
for (j = 0; j < cnt; j++) {
els[j].style.display = "none";
}
}
}
}
</script>
콘솔에 오류가 있는지 확인 했습니까? –
안녕하세요 @ hopkins - 매트 예, 나는 그것이 어떤 이유로, HTML을 이에 상응하는이야 그것으로 대체 소스 코드에서 괄호를 읽지 않았어 대답을 찾았 믿고 –