eBook authors eBook Software - create and publish your own ebooks
Create your own eBooks
 
   
EBookApprentice.com
Learn How To Create, Publish & Market E-Books
 
   
EBookCompiler.com
E-Book Creation Software
 
   
EBookPower.com
Add sophisticated multimedia to your E-Books
 
   
CoverFactory.com
Create E-Book covers in minutes
 
 
  EBookSubmit.com
E-Book Marketing & Promotion made easy
 
  EBookJungle.com
Search engine for E-Books
 
  EBookInterviews.com
Interviews with eBook authors
 
  EBookEnhance.com
Tools for building better eBooks
 
 
 
Archived Message:

Need Help with ##NEXT() and ##PREVIOUS


 
jmiguy I am using the NEXT() and PREVIOUS() ActivScript variables in my book to navigate from page to page. I plan on using CSS so I don't have to manually configure each individual page link.

My question is this, does anyone know how to create a variable that will grab the title of the next (and previous) pages to display it as a screen tip when you hover above the "NEXT>" page hyperlink?

<a title="Title of Next Page" href="##NEXT()">
<a title="Title of Previous Page" href="##PREVIOUS()">

Thanks,

Jeff


Posted on: 8:26 pm on July 12, 2006
Storyman Hi Jimiguy,

Great question...and one that I wish I had an answer to. There are variables for the ebook title, none for available display pages.

One work around would involve using a page ID. I've used it in the past with CSS to gray out the current page displayed on the navigation.  If you do a search you should be able to find a tutorial on how using page IDs. I'm just not sure if it is possible to grab the ID using javascript, then comparing it against a matrix to establish the next/previous page(s).

Let us know if you have any luck.


Posted on: 9:39 pm on July 12, 2006
Alaska Forward and Back buttons are part of most help systems; they are called 'browse sequences' in help author terminology.  Not all help files have them, as many subjects are not sequential anyway.

I use them in copperfieldpub.com, and others.  Its built in to the system.

Here is some Javascript that will fit into a .js file.  Place the .js reference wherever you want the browse sequence to display:

<script language="javascript1.2" src="browse.js"></script>

...and the contents of the .js file will look like this, except you will add your own page names and descriptions, of course:

==========================

Page_name=new Array()
Page_desc=new Array()

Page_name[0]="toc.html"
Page_desc[0]="Table of Contents."
Page_name[1]="ch1.html"
Page_desc[1]="Chapter One: Starting the Journey"
Page_name[2]="ch2.html"
Page_desc[2]="Chapter Two: Packing My Stuff"
Page_name[3]="ch3.html"
Page_desc[3]="Chapter Three: Feeding the Fish"
Page_name[4]="ch4.html"
Page_desc[4]="Chapter Four: Turning out the Lights"
Page_name[5]="ch5.html"
Page_desc[5]="Chapter Five: Locking the Door."
Page_name[6]="references.html"
Page_desc[6]="List of References"


//----------------------start------------------------------
NumberOfFiles=Page_name.length;
StringA=location.href;
LengthA=StringA.length
A=StringA.lastIndexOf("/" )+1;
ThisFilename=StringA.substring(A,LengthA);
//--------------------------------------------------------

/*Find the page number*/
n=NumberOfFiles-1;
foundit=false;
for (var i = 0; i <= n; i++)
{
if (Page_name[ i]==ThisFilename)  // remove space from brackets (forum fix)
{
ThisPageNumber=i;
foundit=true;
break;
}
if (foundit==false) {
ThisPageNumber=0;
}
}


//determine the numbers of the previous and the next pages

function goPrev(){
if ((ThisPageNumber-1)<0)
{
alert("You are at the beginning of the series" )
}
else
{top.location.href=Page_name[ThisPageNumber-1]
}
}

function goNext()
{
n=NumberOfFiles-1;
if ((ThisPageNumber+1)>n)
{
answer = confirm("You are at the end of the series. \nPress OK to go to the start, or \nCancel to remain where you are" );
if (answer !=0)
{
top.location.href=Page_name[0]
}
}
else
{
top.location.href=Page_name[ThisPageNumber+1]
}
}


// writes the previous and next pages

function NextPreviousWriter()
{
if(Page_name[ThisPageNumber-1])
{
document.write("[<b>Back to: </b><a href="+
 Page_name[ThisPageNumber-1]+" title='back to " + Page_desc[ThisPageNumber-1] +"'>"+
   Page_desc[ThisPageNumber-1]+"</a>]" );
}

if(Page_name[ThisPageNumber+1])
{
document.write("<br>[<b>On to: </b><a href="+
 Page_name[ThisPageNumber+1]+" title='forward to " + Page_desc[ThisPageNumber+1]+"'>"+
   Page_desc[ThisPageNumber+1]+"</a>]<br>" );
}
else {
document.write("<br><b>End of series so far. More to come ... "+
   "</b><br>" );
}
}
NextPreviousWriter();

==========================

... and there you go.

 Don't forget to remove that space from the array definiton above (around line 32) ; its a fix due to this forum messing with my code, despite turning emoticons off.  I would ask Sunil to look into it, but I'd rather see 5.0 come out first.


(Edited by Alaska at 1:26 pm on July 13, 2006)


Posted on: 5:56 pm on July 13, 2006
jmiguy Thanks for the reply but I'm a bit confused.

1.) Will this code make the page descriptions appear when you hover over the next and previous page links?

2.) How do I tie this code to a hyperlink? (I'm not very familiar with java script.)

Thanks again,

Jeff


Posted on: 9:51 pm on July 13, 2006
Alaska Jeff-

1) yes.

2) it creates its own hyperlinks as needed.

 Do this: copy the script (between the "===" lines) to a text file, and name it 'browse.js'.  Add it to the folder with your html content files.

 Paste the line:

<script language="javascript1.2" src="browse.js"></script>

...wherever you want to see the browse sequence links.

simple, eh?


Posted on: 10:04 pm on July 13, 2006
jmiguy Roger Thank You!!!!! That's the ticket!

I don't know what I did wrong the first time but it worked perfectly this time.

I'll post back if I have any more problems, but I think I'm okay now.

I checked out your site copperfieldpub.com, but I didn't have much time to look around. I'll check it out some more tonight. It looks like you have some really good stuff posted.

Thanks again,

Jeff


Posted on: 2:26 am on July 14, 2006

Go to Active Discussion Thread

Participate in Current/New Discussions

List All Archived Forums



Copyright © 2000-2015, Answers 2000 Limited.

With any business, it is up to the individual owner of said business to ensure the success of the business. You may make more or less than any sample figures or results that might be quoted on our web sites or other publications. All business involves risk, and many businesses do not succeed. Further, Answers 2000 Limited does NOT represent that any particular individual or business is typical, or that any results or experiences achieved by any particular individual/business is necessarily typical.

Disclosure: Our company's websites' content (including this website's content) includes advertisements for our own company's websites, products, and services, and for other organization's websites, products, and services. In the case of links to other organization's websites, our company may receive a payment, (1) if you purchase products or services, or (2) if you sign-up for third party offers, after following links from this website. Unless specifically otherwise stated, information about other organization's products and services, is based on information provided by that organization, the product/service vendor, and/or publicly available information - and should not be taken to mean that we have used the product/service in question. Additionally, our company's websites contain some adverts which we are paid to display, but whose content is not selected by us, such as Google AdSense ads. For more detailed information, please see Advertising/Endorsements Disclosures

Our sites use cookies, some of which may already be set on your computer. Use of our site constitutes consent for this. For details, please see Privacy.

Contact Us    About and Terms Of Use    Privacy    Advertising/Endorsements Disclosures