javascript对象机制
var currItem = listbox.options[currIndex];
var prevItem = listbox.options[currIndex - 1];
//alert(currItem);
alert(prevItem.text);
listbox.options[currIndex - 1].text = currItem.text;
listbox.options[currIndex - 1].value = currItem.value;
alert(prevItem.text); //两次alert值是不同的
listbox.options[currIndex].text = prevItem.text;
listbox.options[currIndex].value = prevItem.value;
相关文档:
我们在jsp页面上的js脚本中可以调研java代码,比如,我们需要再js中用alert函数显示服务器端发送过来的某个字符串那么我们可以这样做
tomcat下:
在服务器端我们有request.setAttribute("name","abc");
那么我要在页面上用alert显示的话,有两种方式:
1、使用EL表达式
在El表达式的外面用引号即可:
<scri ......
<script type="text/javascript">
window.onbeforeunload=function()
{
alert("onbeforeunload event...");
//return false;
}
</script>
<a href="#" onclick="return true;">测试1</a><br/>
<a href="javascript:void(0)" onclick="return true;">测试2</a><br/& ......
在线编辑内容的时候,那些基于 JavaScript 的编辑器帮了我们大忙,这些所见即所得(WYSIWYG)编辑器,给我们提供了类似
Office 的操作体验。如今,任何网站内容管理系统(CMS)和博客系统都需要一个这样的编辑器。本文精选了10个基于 JavaScript
的编辑器,它们有的是基于 jQuery 框架,有点则不是。
Mar ......
String.prototype.Trim=function(){
returnthis.replace(/(^\s*)|(\s*$)/g,"");
}
String.prototype.LTrim=function(){
returnthis.replace(/(^\s*)/g,"");
}
String.prototype.RTrim=function(){
returnthis.replace(/(\s*$)/g,"");
} ......
function checkImgAddr(url){
var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("post",url,false);
xmlhttp.send();
if(xmlhttp.readyState==4){
if(xmlhttp.status==404){
return "File Not Exist.";
}else if(xmlhttp.status == 200){
re ......