저는 약 4 년 전에 작성한 자바 스크립트 계산기를 업데이트하려고 신경 외과 의사입니다. 두개 내 동맥류에 대한 다양한 변수가 필요하며 세 가지 코호트 연구를 기반으로 추정 된 파열 률을 제공합니다. 동일한 접근법을 사용하여 더 많은 변수를 가진 새로운 메타 분석을 포함하려고합니다. http://www.timkilleen.com/calc1.htmlHTA : 자바 스크립트 계산기 - 새 변수 추가
<strong><large>Aneurysm Calculator - ISUIA</large></strong>
<br>
<br>
<script type="text/javascript">
function getRisk()
{
var size = window.document.getElementById('An_Size').value;
var location = window.document.getElementById('locate').value;
var ysah = window.document.getElementById('yessah');
var nsah = window.document.getElementById('nosah');
x=size;
y=location;
z=ysah.checked?"yes":"no";
if(x==0 ) output(" --/--")
if(x>0&& x<7 && y=="ant" && z=="no" ) output(" 1 /0 ")
if(x>=7&& x<12 && y=="ant" && z=="no" ) output(" 0.9948 /2.6 ")
if(x>=12&&x<25 && y=="ant" && z=="no" ) output(" 0.971 /14.5 ")
if(x>=25 && y=="ant" && z=="no" ) output(" 0.92 /40 ")
if(x>0&& x<7 && y=="post" && z=="no" ) output(" 0.995 /2.5 ")
if(x>=7&& x<12 && y=="post" && z=="no" ) output(" 0.971 /14.5 ")
if(x>=12&&x<25 && y=="post" && z=="no" ) output(" 0.9632 /18.4 ")
if(x>=25 && y=="post" && z=="no" ) output(" 0.9 /50 ")
if(x>0&& x<7 && y=="int" && z=="no" ) output(" 1 /0 ")
if(x>=7&& x<12 && y=="int" && z=="no" ) output(" 1 /0 ")
if(x>=12&&x<25 && y=="int" && z=="no" ) output(" 0.994 /3 ")
if(x>=25 && y=="int" && z=="no" ) output(" 0.9872 /6.4 ")
if(x>0&& x<7 && y=="ant" && z=="yes" ) output(" 0.997 /1.5 ")
if(x>=7&& x<12 && y=="ant" && z=="yes") output(" 0.9948 /2.6 ")
if(x>=12&&x<25 && y=="ant" && z=="yes" ) output(" 0.971 /14.5 ")
if(x>=25 && y=="ant" && z=="yes" ) output(" 0.92 /40 ")
if(x>0&& x<7 && y=="post" && z=="yes" ) output(" 0.9932 /3.4 ")
if(x>=7&& x<12 && y=="post" && z=="yes" ) output(" 0.971 /14.5 ")
if(x>=12&&x<25 && y=="post" && z=="yes" ) output(" 0.9632 /18.4 ")
if(x>=25 && y=="post" && z=="yes" ) output(" 0.9 /50")
if(x>0&& x<7 && y=="int" && z=="yes" ) output(" 1 /0 ")
if(x>7&& x<12 && y=="int" && z=="yes" ) output(" 1 /0 ")
if(x>=12&&x<25 && y=="int" && z=="yes" ) output(" 0.994 /3 ")
if(x>=25 && y=="int" && z=="yes" ) output(" 0.9872 /6.4 ")
}
function output(str)
{
var arr = str.split("/");
var one_yr_risk = parseFloat(arr[0]);
var life_expectancy = parseFloat(window.document.getElementById('life_expectancy').value);
var cum_risk="--";
var five_yr_risk="--"
{
five_yr_risk = arr[1];
cum_risk = Math.round(((1-Math.pow((one_yr_risk), life_expectancy))*100)*10)/10;
}
window.document.getElementById('r2').value=five_yr_risk;
if(life_expectancy<10)
cum_risk="--";
if(cum_risk===0)
cum_risk="0*";
window.document.getElementById('r1').value=cum_risk;
}
</script>
<img alt="" src="/sites/default/files/COW.gif" style="width: 250px; height: 284px; border-width: 0px; border-style: solid; margin: 0px;" />
<form action="" id="riskform" onSubmit="return false;">
<fieldset>
<label for="locate">Location</label>
<select id="locate" name='locate'
onchange="getRisk()">
<option value="ant">Anterior circulation</option>
<option value="post">Posterior circulation (incl. PCom)</option>
<option value="int">Intracavernous</option>
</select>
<br>
<br>
<p>
<label class="inlinelabel" for='includeinscription'>
Size(mm)</label>
<input type="text" id="An_Size" size=7 onKeyUp="getRisk()"
name="size" value="0" />
</p>
<label >Previous SAH?</label>
<input type="radio" name="prevsah" value="yessah" id="yessah"
onclick="getRisk()" />
Yes
<input type="radio" name="prevsah" value="nosah" id="nosah"
onclick="getRisk()" />
No
<br>
<br>
<label for="Five_Year">5 Year Rupture Risk (%)</label>
<input type="text" name="val3" id="r2"><span id="result2"></span>
<p>
<p>
<br>
<label class="inlinelabel" for='includeinscription'>
Estimated life expectancy (minimum 10 years)</label>
<input type="text" id="life_expectancy" size=7 onKeyUp="getRisk()"
name="size" value="0" />
</p>
<label for="One_Year">Cumulative Lifetime Rupture Risk (%)</label>
<input type="text" name="val3" id="r1"><span id="result1"></span>
<div id="Final_Risk"></div>
</fieldset>
</form>
나는 두 개의 새로운 예/아니오 변수와 추가를 추가했습니다 : 나는 새로운 변수를 추가 할 때 불행하게도, 함수 경우, 계산기가 고장 ....
원래 계산기는 다음과 같이 작동 가능한 if 함수의 크기를 기하 급수적으로 증가시킨 드롭 다운 선택 (민족성) (간결성을 위해 포함되지 않음, 아래 예 참조).
:<script type="text/javascript">
function getRisk()
{
var size = window.document.getElementById('An_Size').value;
var location = window.document.getElementById('locate').value;
var ysah = window.document.getElementById('yessah');
var nsah = window.document.getElementById('nosah');
var eth = window.document.getElementById('ethno').value;
var osev = window.document.getElementById('oversev');
var usev = window.document.getElementById('undersev');
var yhtn = window.document.getElementById('yhyp');
var nhtn = window.document.getElementById('nhyp');
u=yhtn.checked?"yes":"no";
v=osev.checked?"yes":"no";
w=eth;
x=size;
y=location;
z=ysah.checked?"yes":"no";
내가 잘못 여기에 HTML 양식 설정 한 추가 변수를 구현 및/또는 부정확 한 확신 다음과 같이
if(x>=20 && y=="oth" && z=="no" && u=="yes" && v=="no" && w="jp" ) output(" 0.9644 /17.8 ")
새로운 변수가 설정되어
</select>
</p>
<label >Previous SAH?</label>
<input type="radio" name="prevsah" value="yessah" id="yessah"
onclick="getRisk()" />
Yes
<input type="radio" name="prevsah" value="nosah" id="nosah"
onclick="getRisk()" />
No
<p>
<label >Hypertension?</label>
<input type="radio" name="htn" value="yhyp" id="yhyp"
onclick="getRisk()" />
Yes
<input type="radio" name="htn" value="nhyp" id="nhyp"
onclick="getRisk()" />
No
<p>
<label >Age over 70?</label>
<input type="radio" name="oversev" value="osev" id="osev"
onclick="getRisk()" />
Yes
<input type="radio" name="oversev" value="usev" id="usev"
onclick="getRisk()" />
No
<br>
모든 조언을 주시면 감사하겠습니다.
행복을 빌며,
팀
새 코드 (깨짐) : http://www.timkilleen.com/calc3.html – user2521705
원본 코드 : http://www.timkilleen.com/calc1.html – user2521705
[편집] 코드 (링크는 문제가 없지만 코드 자체는 질문 본문에 있어야 함) –