我还处于javascript的学习阶段,所以我希望有一个简单的解决方法。
我有一个图像地图区域,可以在onclick上运行javascript函数。
以下是我所拥有的:
区域映射的相关HTML:
<img id="imageMaps" src="images/20keys.jpg" usemap="#20Keys" width="100%" alt="Select Key" border="0"/>
<map id="20keys" name="20keys">
<area shape="circle" alt="Key 1" title="Key 1" coords="42,54,32" href="#" name="key1area" onclick="keySelected(1);"/>
</map>
目标片段的相关HTML:
<div data-role="dialog" id="keyPopup" data-theme="b">
<div data-role="header">
<h1 id="keyHeader"><!--Key Description Here --></h1>
</div> <!-- /header -->
<div data-role="content">
<p><a id="summaryButton" href="#pdfReader" data-role="button" data-ajax="false" onclick="pdfSelected('summary');">Summary of Key <!--Key Number Here --></a></p>
<p><a id="manualButton" href="#pdfReader" data-role="button" data-ajax="false" onclick="pdfSelected('manual');">View Key <!--Key Number Here --> Manual</a></p>
<p><a id="interactionsButton" href="#pdfReader" data-role="button" data-ajax="false" onclick="pdfSelected('interactions');">Interaction of Key <!--Key Number Here --> with Other Keys</a></p>
</div> <!-- /content -->
<div data-role="footer">
<p class="margin">
<a href="#home" data-rel="back" data-role="button" data-inline="true" data-icon="back">Back</a>
</p>
</div> <!-- /footer -->
</div> <!-- /#keyPopup -->
相关的Javascript:
var keyNumber = 0;
function keySelected(key) {
keyNumber = key;
//Alert 1
if (keyNumber === 1) {
document.getElementbyId('keyHeader').innerHTML = 'Key 1 - Description';
document.getElementbyId('summaryButton').innerHTML = 'Summary of Key 1';
document.getElementbyId('manualButton').innerHTML = 'Manual of Key 1';
document.getElementbyId('interactionsButton').innerHtml = 'Interaction of Key 1 with Other Keys';
//Alert 2
}
}
如果我添加window.alert("test");
@&#34; //提醒1&#34;它会在#34;警报2&#34;上运行,但有关如何使其正常运行的任何想法?
如果我发布任何可能与此有关的重要细节,请告诉我。感谢...
答案 0 :(得分:0)
我没有的问题很简单......
document.getElement的乙强> YID()
对此感到抱歉......