网页内容繁简体切换(任意页面点击繁体后,其他页面也变成繁体)

head.html文件中插入:

1
2
3
4
5
6
7
8
<!-- 繁简体转换 -->         
<script language='javascript' src='../js/zh.js'></script>
<script type="text/javascript" src="../js/load.js"></script>
<div>
<a href="javascript:zh_tran('s');" class="zh_click" id="zh_click_s" onclick="setCookieValue('s')">简体</a>|
<a href="javascript:zh_tran('t');" class="zh_click" id="zh_click_t" onclick="setCookieValue('t')">繁体</a>
</div>
<!-- 繁简体转换 -->

Read More

php关于网页乱码问题

指定浏览器打开网页的编码格式

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

当浏览器设置了编码方式为自动选择时:打开网页的编码方式即为charset指定的gb2312。

注意:charset=gb2312要和mysql_query("set names gbk");保持一致!!

Read More

CSS之Position详解

CSS的很多其他属性大多容易理解,比如字体,文本,背景等。有些CSS书籍也会对这些简单的属性进行大张旗鼓的介绍,而偏偏忽略了对一些难缠的属性讲解,有避重就轻的嫌疑。CSS中主要难以理解的属性包括盒型结构,以及定位。正如 positioniseverything,本文将主要讲述关于position的理解,力求让您看完本文后对position有着最全面的认识。

position的四个属性值:

  • relative
  • absolute
  • fixed
  • static

Read More

js得到select下拉列表中option的value和text

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<select id="sel" onchange="javascript:getSelect();">
<option value="a">选择</option>
<option value="bdd">be</option>
<option value="c">ce</option>
<option value="d">de</option>
<option value="e">ee</option>
</select>
<script>
function getSelect() {
//得到select下拉列表中option的value
var optionValue =
document.getElementById("sel").options[document.getElementById("sel").options.selectedIndex].value;
//得到select下拉列表中option的text
var optionText =
document.getElementById("sel").options[document.getElementById("sel").options.selectedIndex].text;
}
</script>

<select id="sele" onchange="javascript:getE();">
<option value="monday">星期一</option>
<option value="tuesday">星期二</option>
<option value="wednesday">星期三</option>
<option value="thursday">星期四</option>
<option value="friday">星期五</option>
</select>
<script>
function getE() {
//我建议这里也像下面一些写,虽然这样写也可以获得数据
var optionsValue = document.getElementById("sele").value;
alert(optionsValue);
var optionsText = document.getElementById("sele").options[document.getElementById("sele").options.selectedIndex].text;
alert(optionsText);
}
</script>