2013-04-28 3 views
0

라디오 버튼 중 하나를 클릭하면 하단의 링크가 변경됩니다. 웹 페이지의 유효성을 검사했는데 오류가 없습니다. 나는 자바 스크립트 코드를 교정하고 잘못된 점은 없다. 다른 DOCTYPE을 사용해야합니까?Javascript 코어가 작동하지 않는 이유는 무엇입니까?

<script type="text/javascript"> 
/* <![CDATA[ */ 
function udpateInvestmentLink(urlText, urlValue) { 
     document.getElementById('recommendedInvestment').innerHTML = urlText + " (Yahoo! Finance)"; 
     document.getElementById('recommendedInvestment').href = urlValue; 
} 
/* ]]> */ 
</script> 
</head> 
<body> 
<form action="" enctype="application/x-www-form-urlencoded"> 
<p> 
<input type="radio" name="industry" onclick="updateInvestmentLink('Gold', 'http://finance.yahoo.com/q?s=^YH0h714')" />Basic Materials<br /> 
<input type="radio" name="industry" onclick="updateInvestmentLink('General Electric Industries Ltd.', 'http://finance.yahoo.com/q/pr?s=ge')" />Conglomerates<br /> 
<input type="radio" name="industry" onclick="updateInvestmentLink('Tyson Foods Inc.', 'http://finance.yahoo.com/q/pr?s=tsn')" />Consumer Foods<br /> 
<input type="radio" name="industry" onclick="updateInvestmentLink('Catalyst Health Solutions', 'http://finance.yahoo.com/q/pr?s=chsi')" />Financial<br /> 
<input type="radio" name="industry" onclick="updateInvestmentLink('Genentech Inc.', 'http://finance.yahoo.com/q/pr?s=dna')" />Healthcare<br /> 
<input type="radio" name="industry" onclick="updateInvestmentLink('Toll Brothers', 'http://finance.yahoo.com/q/pr?s=tol')" />Industrial Goods<br /> 
<input type="radio" name="industry" onclick="updateInvestmentLink('Sinclair Broadcast Group Inc.', 'http://finance.yahoo.com/q/pr?=sbgi')" />Services<br /> 
<input type="radio" name="industry" onclick="updateInvestmentLink('Verizon Communications Inc.', 'http://finance.yahoo.com/q/pr?s=vz')" />Technology<br /> 
<input type="radio" name="industry" onclick="updateInvestmentLink('Northwest Natural Gas Co.', 'http://finance.yahoo.com/q/pr?s=nwn')" />Utilities</p> 
</form> 
<p><a href="http://finance.yahoo.com/" id="recommendedInvestment">Yahoo! Finance</a></p> 

답변

7

function updateInvestmentLink(urlText, urlValue) { 
     document.getElementById('recommendedInvestment').innerHTML = urlText + " (Yahoo! Finance)"; 
     document.getElementById('recommendedInvestment').href = urlValue; 
} 
+0

는 감사 기능 정의에 교환되는 맞춤법 실수 udpateInvestmentLinkupdateInvestmentLink, P와 D가있다! : O 나는 그것을 보지 않았다. –

관련 문제