资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

javascript换页,js替换整个页面

javascript用什么换行

js中alert弹出窗口换行用"\n"

成都创新互联公司坚持“要么做到,要么别承诺”的工作理念,服务领域包括:做网站、网站建设、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的岫岩网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!

如果这个不可以的话就是"\\n"

比如:

script type="text/javascript"

alert("hello \n world!");

/script

vb.net向webbrowser执行javascript代码进行翻页,如何读翻页后的数据

不想用点击,直接执行,那么你肯定就不能用onclick事件了。

在网页中JS函数自动执行常用三种方法

在HTML中的Head区域中,有如下函数:

SCRIPT

LANGUAGE="JavaScript"

functionn

MyAutoRun()

{

 //以下是您的函数的代码,请自行修改先!

 alert("函数自动执行哦!");

}

/SCRIPT

下面,我们就针对上面的函数,让其在网页载入的时候自动运行!

①第一种方法

将如上代码改为:

SCRIPT

LANGUAGE="JavaScript"

functionn

MyAutoRun()

{

 //以下是您的函数的代码,请自行修改先!

 alert("函数自动执行哦!");

}

window.onload=MyAutoRun();

//仅需要加这一句

/SCRIPT

②第二种方法

修改网页的Body为:

body onLoad="MyAutoRun();"

或者改为:

body onLoad="javascript:MyAutoRun();"

③第三种方法

使用JS定时器来间断性的执行函数:

setTimeout("MyAutoRun()",1000); //隔1000毫秒就执行一次MyAutoRun()函数

实现方法,将最上面的那JS函数,改为:

SCRIPT

LANGUAGE="JavaScript"

functionn

MyAutoRun()

{

 //以下是您的函数的代码,请自行修改先!

 alert("函数自动执行哦!");

}

setTimeout("MyAutoRun()",1000);

//这样就行拉

/SCRIPT

js点击一个按钮,怎么让PageControl翻页

在javabean里设计package Date;

public class SplitPage {

//分页请求时,请求标识参数

final public static String FIRSTPAGE="first";//请求第一页

final public static String PREVIOUSEPAGE="previous";//请求上一页

final public static String NEXTPAGE="next";//请求下一页

final public static String LASTPAGE="last";//请求最后一页

private int pageRows=10;//每页显示记录数,默认10条,可以在页面设置

private int totalRows=0;//总的记录数,这个参数由NoteDAO对象提供

private int currentPage=1;//当前显示的页面编号,默认第一页

private int firstPage=1;//首页位置,默认第一页

private int totalPages=1;//总的页面数量,默认就一页

public int getCurrentPage() {

return currentPage;

}

public void setCurrentPage(int currentPage) {

this.currentPage = currentPage;

}

public int getFirstPage() {

return firstPage;

}

public void setFirstPage(int firstPage) {

this.firstPage = firstPage;

}

public int getPageRows() {

return pageRows;

}

public void setPageRows(int pageRows) {

if(pageRows==0)throw new ArithmeticException();

this.pageRows = pageRows;//如果pageRows被设置为零,应当抛出异常.

//修改每页显示记录数,将会直接影响总页面数,所以要同时修改

this.totalPages=(this.totalRows%this.pageRows==0)?this.totalRows/this.pageRows:this.totalRows/this.pageRows+1;

}

public int getTotalRows() {

return totalRows;

}

//设置分页对象的总记录属性后,就应该根据每页面显示记录数,计算得到总的页面数

public void setTotalRows(int totalRows) {

this.totalRows = totalRows;

//计算总的页面数(或最后的页面号),两个整数相除如果刚好除尽,值就是相除后的商,否则如果有余数,商应当还加1.

this.totalPages=(this.totalRows%this.pageRows==0)?this.totalRows/this.pageRows:this.totalRows/this.pageRows+1;

}

//不应该提供方法设置总页面数,它是计算得到的

//但应当提供获取总页面数的方法.

public int getTotalPages() {

return totalPages;

}

//根据请求页面的标识参数,重新计算当前要显示的页面

//核心方法,实现分页显示功能.

public int confirmPage(String flag){

int newPage=this.currentPage;

if(flag!=null){//flag只可能是下面值之一

if(flag.equals(SplitPage.FIRSTPAGE)){

newPage=1;

}else if(flag.equals(SplitPage.LASTPAGE)){

newPage=this.totalPages;

}else if(flag.equals(SplitPage.NEXTPAGE)){

//页面总数和当前页面编号相等吗,如果是那么页面编号不往后走,否则页面编号加一

newPage=(this.totalPages==this.currentPage)?this.currentPage:this.currentPage+1;

}else if(flag.equals(SplitPage.PREVIOUSEPAGE)){

//第一个页面和当前页面相等吗,如果是那么页面编号不往前走,否则页面编号减一

newPage=(this.firstPage==this.currentPage)?this.currentPage:this.currentPage-1;

}else{//否则是一个数字字符串

int tpage=Integer.parseInt(flag.trim());

newPage=tpage;

}

}else{//如果请求标识参数为空,那么当前页码不变

newPage=this.currentPage;

}

//在返回前设置当前页面

this.setCurrentPage(newPage);

return newPage;

}

}

如何用js做翻页效果

参考代码如下:

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""

html xmlns="" 

head

title/title

script type="text/javascript" language="javascript" src=""/script

script type="text/javascript" language="javascript"

$(function() {

$("#right").click(function() {

var roll = $("div/div", { css: { position: "absolute", border: "solid 1px #999", left:    "806px", top: "10px", height: "494px", width: "1px", background:                     "#fff"}}).appendTo($("#book").parent());

$(roll).animate({

left: "10px",

width: "398px"

}, 1000, function() {

$("#left").css({"background":"#fff"});

$(roll).fadeOut(300, function() {

$(roll).remove();

})

});

});

});

/script

/head

body style="padding:5px;margin:0;"

div id="book" style="width:797px;height:494px;background:#ccc;border:solid 6px #ccc;"

div id="left" style="width:398px;height:494px;float:left;background:url() no-repeat top left;cursor:pointer;"/div

div id="right" style="width:398px;height:494px;float:left;background:#fff;cursor:pointer;margin-left:1px;text-align:right;"p style="margin-top:470px;font-size:12px;color:#999;"点这翻页  /p/div

/div

/body

/html

如图所示,点击1,2,3,4四个按钮以后,图片会实现换页的效果,请问这个javascript代码怎么写?

四个按钮对应四张图片呗 首先你的jsp页面有一张图片 img id="img" src=""/

4个按钮input id="inp1" type="button" onclick="change1()"/

input id="inp2" type="button" onclick="change2()"/

...

script:

function change1(){

document.getElementById('img').src="第一张图片的地址";

}

function change2(){

document.getElementById('img').src="第二张图片的地址";

}

。。。

请问,如何使用JavaScript实现div的自动换页?

js静态分页,

你可以参考一下

style

* {

font-size:10.2pt;

font-family:tahoma;

line-height:150%;

}

.divContent

{

border:1px solid red;

background-color:#FFD2D3;

width:500px;

word-break:break-all;

margin:10px 0px 10px;

padding:10px;

}

/style

header

div id="divPagenation"/div

div id="divContent"/div

footer

script language="jscript"

!--

s="p女老师竭力向孩子们证明,学习好功课的重要性。 /pp她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” /pp“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” /pp女老师竭力向孩子们证明,学习好功课的重要性。 /pp她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” /pp“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” /pp女老师竭力向孩子们证明,学习好功课的重要性。 /pp她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” /pp“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” /pp女老师竭力向孩子们证明,学习好功课的重要性。 /pp她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” /pp“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” /pp女老师竭力向孩子们证明,学习好功课的重要性。 /pp她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” /pp“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” /p";

function DHTMLpagenation(content) { with (this)

{

// client static html file pagenation

this.content=content;

this.contentLength=content.length;

this.pageSizeCount;

this.perpageLength=100; //default perpage byte length.

this.currentPage=1;

//this.regularExp=/.+[\?\]page=(\d+)/;

this.regularExp=/\d+/;

this.divDisplayContent;

this.contentStyle=null;

this.strDisplayContent="";

this.divDisplayPagenation;

this.strDisplayPagenation="";

arguments.length==2?perpageLength=arguments[1]:'';

try {

divExecuteTime=document.createElement("DIV");

document.body.appendChild(divExecuteTime);

}

catch(e)

{

}

if(document.getElementById("divContent"))

{

divDisplayContent=document.getElementById("divContent");

}

else

{

try

{

divDisplayContent=document.createElement("DIV");

divDisplayContent.id="divContent";

document.body.appendChild(divDisplayContent);

}

catch(e)

{

return false;

}

}

if(document.getElementById("divPagenation"))

{

divDisplayPagenation=document.getElementById("divPagenation");

}

else

{

try

{

divDisplayPagenation=document.createElement("DIV");

divDisplayPagenation.id="divPagenation";

document.body.appendChild(divDisplayPagenation);

}

catch(e)

{

return false;

}

}

DHTMLpagenation.initialize();

return this;

}};

DHTMLpagenation.initialize=function() { with (this)

{

divDisplayContent.className=contentStyle!=null?contentStyle:"divContent";

if(contentLength=perpageLength)

{

strDisplayContent=content;

divDisplayContent.innerHTML=strDisplayContent;

return null;

}

pageSizeCount=Math.ceil((contentLength/perpageLength));

DHTMLpagenation.goto(currentPage);

DHTMLpagenation.displayContent();

}};

DHTMLpagenation.displayPage=function() { with (this)

{

strDisplayPagenation="分页:";

if(currentPagecurrentPage!=1)

strDisplayPagenation+='a href="javascript:void(0)" onclick="DHTMLpagenation.previous()"上一页/a  ';

else

strDisplayPagenation+="上一页  ";

for(var i=1;i=pageSizeCount;i++)

{

if(i!=currentPage)

strDisplayPagenation+='a href="javascript:void(0)" onclick="DHTMLpagenation.goto('+i+');"'+i+'/a  ';

else

strDisplayPagenation+=i+"  ";

}

if(currentPagecurrentPage!=pageSizeCount)

strDisplayPagenation+='a href="javascript:void(0)" onclick="DHTMLpagenation.next()"下一页/a  ';

else

strDisplayPagenation+="下一页  ";

strDisplayPagenation+="共 " + pageSizeCount + " 页,每页" + perpageLength + " 字符,调整字符数:input type='text' value='"+perpageLength+"' id='ctlPerpageLength'input type='button' value='确定' onclick='DHTMLpagenation.change(document.getElementById(\"ctlPerpageLength\").value);'";

divDisplayPagenation.innerHTML=strDisplayPagenation;

}};

DHTMLpagenation.previous=function() { with(this)

{

DHTMLpagenation.goto(currentPage-1);

}};

DHTMLpagenation.next=function() { with(this)

{

DHTMLpagenation.goto(currentPage+1);

}};

DHTMLpagenation.goto=function(iCurrentPage) { with (this)

{

startime=new Date();

if(regularExp.test(iCurrentPage))

{

currentPage=iCurrentPage;

strDisplayContent=content.substr((currentPage-1)*perpageLength,perpageLength);

}

else

{

alert("page parameter error!");

}

DHTMLpagenation.displayPage();

DHTMLpagenation.displayContent();

}};

DHTMLpagenation.displayContent=function() { with (this)

{

divDisplayContent.innerHTML=strDisplayContent;

}};

DHTMLpagenation.change=function(iPerpageLength) { with(this)

{

if(regularExp.test(iPerpageLength))

{

DHTMLpagenation.perpageLength=iPerpageLength;

DHTMLpagenation.currentPage=1;

DHTMLpagenation.initialize();

}

else

{

alert("请输入数字");

}

}};

// method

// DHTMLpagenation(strContent,perpageLength)

DHTMLpagenation(s,100);

//--

/script


分享文章:javascript换页,js替换整个页面
文章URL:http://cdkjz.cn/article/dsgihjp.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220