LiveZilla Live Help
 


Go Back   Chime Host - Web Hosting Forum > World Wide Web > Programming / Scripting / Coding Forum > Javascript
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Javascript Need help with the (primarily) client-side programming language? This is the place. Includes discussion on AJAX (Asynchronous JavaScript and XML).

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-22-2009, 10:02 AM
Junior Member
 
Join Date: Oct 2009
castro is on a distinguished road
Default How do I make my the next page load using JavaScript?

code: class with javascript:::

private ClientScriptManager cs;
public LeavingPage(Page page)
{
this.page = page;
WriteJavaScipt();
}

private void WriteJavaScipt()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
string scriptString;
scriptString = "<script language=JavaScript> " +
"string AskMsg; " +
"function LeavePage(){" +
" if(AskMsg){ " +
" ok = confirm(" + "Have you saved your changes? Click OK to Continue to the next page WITHOUT saving." + "\n" +
"Click Cancel to return to the current page." + ");" +
" if (!ok) " +
" {" +
" return false;" +
" }" +
" else" +
" { " +
" return true; " +
" } " +
" } " +
" else" +
" { " +
" return true;" +
" } " +
"} " +
"</script> ";

cs = this.page.ClientScript;

if (!cs.IsClientScriptBlockRegistered(this.GetType(), "clientScript"))
cs.RegisterClientScriptBlock(this.GetType(), "scriptString", sb.ToString());
}
}
================================================
aspx file:

<body>
<br />
<form id="form1" runat="server">
<div>
<img id= "welPage" alt = "Welcome Page" enableviewstate= "true" src="img/welcome.jpg" usemap ="#tier1"/>

<map id="tier1">
<area shape="circle" coords="330, 441, 31" href="javascript: changePage('/mainNav.ascx', '/modules/Books/UserControl1/BookNewEntry.ascx');" alt="Welcome Page" />
</map>


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

function changePage(HeaderURL, BodyURL)
{
if(LeavePage())
{
if(BodyURL != '')
parent.main.location.href = BodyURL;
}
parent.header.location.href = HeaderURL;
}
</script>


</div>
</form>
<div id ="footer">
Copyright © 2009
By OmSolution Inc. All Rights Reserved.
</div>
</body>
=================================================
ChangePage is suppose to load the other pages when the button in the <map> is clicked

But when it click the buttton "if(LeavePage())"
gives the error "Microsoft JScript runtime error: Object expected"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Make a Countdown Clock Using JavaScript? Dr. Phil Javascript 0 10-19-2009 12:51 AM
how to use elseif in javascript to make an iframe visible or hidden when a link is... jumar j Javascript 1 10-17-2009 09:09 PM
JavaScript: I need to make a calculator for Richardd B Javascript 1 05-24-2007 07:05 PM
My forum’s administration panel will not load. It is displaying a blank white page bobleny Tutorials 7 02-15-2007 06:50 PM
The ads make my page unaccessible Bieb's Page Web Hosting Support 6 01-24-2006 09:13 PM


All times are GMT +1. The time now is 06:29 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright ChimeHost, a Profuse Solutions LLC company