Tag: JS预览模式: 普通 | 列表
10-09
26

js控制小写自动变成大写

实例
当您在例子中的输入域中键入字符时,字符会被更改为大写(逐一地):

<html>

<head>
<script type="text/javascript">
function upperCase(x)
{

查看更多...

Tags: JS 大写 小写

分类:Ajax/Js | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 364
09-07
08

JavaScript 中的replace方法,正则或字符串全部交替

第一次发现javascript中replace() 方法如果直接用str.replace("-","!") 只会替换第一个匹配的字符.

引用内容 引用内容
replace()
The replace() method returns the string that results when you replace text matching its first argument
    (a regular e­xpression) with the text of the second argument (a string).
    If the g (global) flag is not set in the regular e­xpression declaration, this method replaces only the first
    occurrence of the pattern. For example,

var s = "Hello. Regexps are fun.";s = s.replace(/\./, "!"); // replace first period with an exclamation pointalert(s);

查看更多...

Tags: JS replace all 正则

分类:Ajax/Js | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 321
08-09
01

JS来调用session

<input type="hidden" id=sess name="hiddenField" value=<%=session("userid")%>>
<script>
function jc()
{
if (document.getElementById("sess").value=="")
{
alert("用户未登录!")
//下面放停止执行代码
}

查看更多...

Tags: JS HTML session

分类:学习 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 966
08-08
04

请教一个js访問Action的問趧

需求:网站中每一个用户都有自己的信箱,在用户没有操作的情况下,该用户如果收到了其他用户发来的邮件,该邮件便会自动打开一个窗口来显示器内容。  

我的想法是这樣:做一个页面,这个页面被打开之后是静止的,里面Js的代码每隔半分钟去调用一次Action,Action中来判断是否有了新的邮件,如果出现新邮件则在Session里面存储一个值,页面在Js在循环的时候,如果该值为非空的时候则打开一个姒该值为地址的新窗口,窗口中来显示新邮件的内容。  


Action里面  

public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) {

查看更多...

Tags: JS Action

分类:学习 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 744
08-03
28

随意切换的网页换肤程序

今天终于写完了一个 可以水平下拉菜单和垂直下拉菜单之间随意切换的网页换肤程序,它综合应用了水平下拉菜单,垂直下拉菜单,网页换肤等技巧.

这个程序需要用到三个文件,一个是h.css,用作水平下拉菜单的样式文件,另一个是v.css,用作垂直下拉菜单的样式文件,最后一个就是包含下拉菜单内容的网页文档test.html.

test.html文件内容:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

查看更多...

Tags: CSS JS

分类:Ajax/Js | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 507
07-12
24

eclipse中JS中文乱码解决...

可依次选择"window">>"preferences">>"general">>"content types"

在右边的窗口中打开列表,选中"JavaScript",在下面的"default encoding"右边的输入框中输入"GBK"或"GB2312"再点"update"按钮,再打开JS文件就可以

如果没有提供选择向,在下面的“文件关联”中添加一个“*.js”,然后指定编码为"GBK"或"GB2312"就可以了

查看更多...

Tags: JS 中文乱码 乱码

分类:Database | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 792