IE6用Javascript提交表单的问题

最近做网站,把IE6能碰到的问题基本碰了个遍,今天又碰到JS提交表单页面不刷新的问题

因为要用图片做按钮来提交表单,所以使用了如下代码:

<a href="javascript:void(0)" onclick="submitForm()"></a>

然后css去定义背景什么的,这些略掉

结果在IE6下点提交页面不跳转,折腾的时候又发现有些情况表单实际上已经提交了只是页面没有跳转
看到有人说应该使用setTimeout来提交,经过测试还是不行,根本就没有执行setTimeout里面的方法

最后查到是javascript:void(0)的问题,在IE6中当href=”javascript:void(0)”时是有可能中止当前的js操作的,
改成href=”#”,页面就跳转了(虽然还是有点小问题,就是先更改页面焦点到”#”然后才提交)

当然这个问题可以直接使用div等其他容器的onclick来实现应该就行了,没必要使用a这个超链接标签

标签:, , , , ,

相关日志

一个完整的表格样式

一坨针对IE的HACK

  1. table.default {
  2.     background: #C1DCF7 none repeat scroll 0%;
  3.     border: 1px solid #C1DCF7;
  4.     color: #000000;
  5.     width: 98%;
  6.     border-collapse: collapse;
  7.     margin: 0 auto;
  8. }
  9.  
  10. table.default caption {
  11.     background:transparent url(http://blog.sunshow.net/wp-content/uploads/2008/04/bg_list.gif) repeat-x scroll 0%;
  12.     height: 30px !important;
  13.     line-height: 30px;
  14.     text-align: left;
  15.     padding-left: 10px;
  16.     font-size: 14px;
  17.     font-weight: bold;
  18.     color: #FFFFFF;
  19. }
  20.  
  21. table.default caption a:link, table.default caption a:visited {
  22.     color: #000000;
  23.     font-size: 12px;
  24.     text-decoration: underline;
  25. }
  26.  
  27. table.default caption a:hover {
  28.     font-size: 12px;
  29.     color: #14568A;
  30. }
  31.  
  32. table.default thead tr {
  33.     background: #C1DCF7 none repeat scroll 0%;
  34.     color: #000000;
  35.     height: 25px;
  36.     line-height: 25px;
  37.     text-align: center;
  38.     font-size: 13px;   
  39. }
  40.  
  41. table.default thead tr th {
  42.     border-color: #C1DCF7;        /* fix for IE */
  43. }
  44.  
  45. table.default tbody {
  46.     background: #FFFFFF none repeat scroll 0%;
  47.     text-align: left;
  48. }
  49.  
  50. table.default tbody tr {
  51.     height: 25px;
  52.     line-height: 25px;
  53.     event: expression(
  54.         (this.onmouseover = function() {this.className += ' over';}) &&
  55.         (this.onmouseout = function() {this.className = this.className.replace(' over', '');})
  56.     );
  57. }
  58.  
  59. table.default tbody tr:hover, table.default tbody tr.over {
  60.     background-color: #E8F0FF;
  61. }
  62.  
  63. table.default tbody tr td {
  64.     font-size: 12px;
  65.     padding: 0 0 0 5px;
  66.     border-color: #C1DCF7;        /* fix for IE */
  67. }
  68.  
  69. table.default tbody tr td {    /* fix for IE when align="center" or align="right" */
  70.     padding-left: expression(
  71.         (((this.align == 'center') || (this.align == 'right')) ? '0px' : '5px')
  72.     );
  73.     padding-right: expression(
  74.         ((this.align == 'right') ? '5px' : '0px')
  75.     );
  76. }
  77.  
  78. table.default tbody tr td[align="center"] {
  79.     padding: 0;
  80. }
  81.  
  82. table.default tbody tr td[align="right"] {
  83.     padding: 0 5px 0 0;
  84. }

效果展示:

提示:您可以先修改部分代码再运行

标签:, ,

相关日志

IE6又一bug?

总结一下就是类似#gisarrow.over、#gisarrow.expanded这样的选择符
在使用javascript动态更改className的时候只有最先定义的一个样式有效

在IE6运行以下例子,然后删掉#gisarrow.over做个对比
IE7下还没试

提示:您可以先修改部分代码再运行

标签:, , , , ,

相关日志

再次谴责IE6

对于开发者来说这实在是个很操蛋的浏览器
老革命又遇到了新问题,其实是个老问题
就是在IE6下div无法覆盖select,不管怎么设置z-index

解决办法也不是没有
1、调整select的位置让它显示在div之外;
2、在显示div的时候先隐藏select,完了再恢复;
3、用iframe或者object之类的覆盖;

但是这事情实在是太xhit了
这个浏览器什么时候才能退出历史舞台啊

标签:, , , ,

相关日志

Firefox3 beta3显示Google Reader的问题

自从昨天beta3升级以来我的Google Reader显示就有问题,表现在日志部分无法显示出来
不过别人好像没这个问题,可能是因为我的语言设置是中文,使用的还是老版本的Reader的原因

写了个GreaseMonkey脚本解决了这个问题

// This is a greasemonkey script, for use with the Firefox extension Greasemonkey.
// More info: http://greasemonkey.mozdev.org/
//
// ==UserScript==
// @name		Google Reader Display Fix
// @author		Sunshow
// @e-mail		sunshow@gmail.com
// @Version		0.5
// @description	Google Reader display fix for firefox3 beta 3
// @include	http://www.google.com/reader/*
// ==/UserScript==
var objTable = document.getElementById(’viewer-box-table’);
objTable.style.display = ‘block’;
标签:, ,

相关日志
Page 1 of 41234»

京ICP备05059555号