单击提交按钮时如何显示隐藏图像?单击按钮时出现图像
3
A
回答
0
这将取决于你如何隐藏它。最简单的方法是将图像的类名从隐藏的图像类改为不隐藏的类。
<img src="thesource" class="hidden">
document.getElementById("theid").className = ""; // remove the hidden class.
.classHidden {
display: none;
}
5
你很幸运,我有一个空白的HTML页面准备:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
<meta charset="utf-8" />
<title>Test</title>
<style type="text/css">
.hidden {
display: none;
}
</style>
</head>
<body>
<form>
<input type="submit" id="submit" onclick="document.getElementById('hidden').style.display = 'block';" />
</form>
<img id="hidden" class="hidden" src="foo.png" />
</body>
</html>
0
document.getElementById("submitBtn").onclick = function() {
document.getElementById("imageTag").style.display="block";
return true;
}
0
下面是一个例子
<img class="image_file src="image.jpg" />
<input type="submit" id="submit_button" name="submit_button" />
隐藏在CSS中的图片:
.image_file
{
display:none;
}
使用jQuery:
$('#submit_button').click(function(
$('.image_file').show();
));
,并尽量避免内嵌的JavaScript,它的混乱和难以维持,当你有一个大的网站。
1
使用jQuery:
<img id="image1" src="myimage.jpg" style="display:none;" width="120" height="120"/>
<input type="submit" name="submit" value="submit" onclick"$('#image1').show()"/>
相关问题
- 1. 单击按钮时旋转图像
- 2. 在单击按钮时在JLabel中显示图像时出现问题 - Java
- 3. 当我点击刷新按钮时,图像从不出现
- 4. 在点击后退按钮加载图像时出现问题
- 5. 单击全部按钮时出现问题。 CSS按钮
- 6. Android单击时突出显示一个图像按钮
- 7. 单击按钮时突出显示仅图像
- 8. 按钮与图像,图像消失点击按钮时iOS 10
- 9. 在Orbeon表单中单击按钮时出现错误
- 10. 按钮/图像打开弹出点击
- 11. 单击插件假图像时点击设置按钮
- 12. 在按钮上单击显示图像
- 13. 单击单选按钮时如何调整图像大小
- 14. 单击按钮时隐藏UItableview单元格内的图像
- 15. 图像,鼠标悬停,按钮出现
- 16. 点击按钮时显示图像?
- 17. javascript:点击按钮时移动图像
- 18. 单击时突出显示图像,然后选中单选按钮
- 19. AnimationDrawable单击按钮时出错
- 20. 当鼠标悬停在图像上时,像按钮出现
- 21. 使用按钮更改图像使用Python单击按钮Tkinter
- 22. 黑莓弹出菜单出现在按钮单击事件
- 23. 当点击所选的单选按钮时,出现错误
- 24. ElementNotVisibleException下一页按钮单击时出现Python/Selenium错误
- 25. 单击提交按钮时出现问题的用户
- 26. 当我单击后退按钮时出现Bootstrap模式
- 27. 单击命令按钮时出现对象所需的错误
- 28. iframe中按钮单击时出现“语法错误”(SQL Report)
- 29. 单击按钮时出现NSInvalidArgumentException错误 - xamarin
- 30. 单击需要的按钮时出现错误消息
你是如何隐藏的形象呢?你使用的是像jQuery,Mootools或Prototype这样的javascript框架吗? – 2011-05-20 07:39:55