我是 HTML 和 Javascript 的新手。请有人可以帮助我解决以下问题。以下代码将在页面加载后正常显示 579。但是,我需要它在不刷新整个页面的情况下显示不同的数字。例如,如果触发了鼠标点击等事件,则会显示 795(图像)。我该怎么做才能使图像中的新数字显示在与以前相同的位置。非常感谢。
` DisplayNumImg(5,7,9);
<a href="#" onclick="DisplayNumImgChanged(7,9,5)" /a>
#child2-3
{
position: absolute;
width: 165px;
height: 15px;
left: 5px;
top: 40px;
}
.thumb_child1
{
float:right;
margin:0px;
}
function DisplayNumImg( a, b, c)
{
var s;
if ( a == 5 ) {
s = '<img class="thumb_child1" src="./images/5_blu.png"> ';
document.write( s );
}
if ( a == 7 ) {
s = '<img class="thumb_child1" src="./images/7_blu.png"> ';
document.write( s );
}
if ( a == 9) {
s = '<img class="thumb_child1" src="./images/9_blu.png"> ';
document.write( s );
}
}
function DisplayNumImgChanged( a,b,c )
{
// please help me with code here or something that you think it would work. Thanks.
}
`