>Why does it have to be done in Javascript anyway? It
>can be done relatively straight forward with Witango
>and still look exactly the same to the user as the
>Javascript you've given below.
OK, I'll admit that there's no real reason to do it in javascript - and in fact there
are good reasons not to. I'm still on Tango 3.6 and probably will be for some time so
maybe it seemed easier...
I did quite a bit of work on it yesterday; this is how far I've got. I gave up on the
looping to generate the page numbers (that really seems ideally suited to javascript)
and worked on the start record and page number logic and on making the current page
number bold
This is the "jump to page number x" code. I've used an ARG "pagenumber" with an ID
from the link. It also allows the number of records returned to be set
<SCRIPT LANGUAGE="JAVASCRIPT">
function GoToPage( id )
{
window.location = ( 'http://www.bolide.co.uk<@CGI><@APPFILE>?link=<@ARG
link>&rows=10&&pagenumber=' + id);
}
</SCRIPT>
The page to be displayed is set up in the Search Builder with
"Start Retrieval at Row Number" = <@CALC EXPR="(<@ARG PAGENUMBER> * <@ARG ROWS>) -
<@ARG ROWS> +1">
This sets the current page as Bold - except when it's the first page because there's
no pagenumber ARG... You need a page Onload in the body tag
onLoad="javascript:BoldId();"
<SCRIPT LANGUAGE="JAVASCRIPT">
function BoldId( id )
{
document.getElementById("PageNumber"+<@ARG PAGENUMBER>).style.fontWeight =
"bold";
}
</SCRIPT>
Finally the buttons are as follows:
<a href="javascript:GoToPage('1');" id='PageNumber1' onMouseOver='window.status="Page
1" ; return true'>1</a>|<a href="javascript:GoToPage('2');" id='PageNumber2'
onMouseOver='window.status="Page 2" ; return true'>2</a>|<a
href="javascript:GoToPage('3');" id='PageNumber3' onMouseOver='window.status="Page 3"
; return true'>3</a>
This is all work in progress so just use it as reference if it's of interest. Of all
of it I think the Bold script is the most elegant, even though it makes the link code
more complex
The pagenumber arg gives the option of delivering pages by page number, rather than
record number, which I quite like
My final feeling is that it would be easier to do in WiTango. It was the generation of
the page numbers that attracted me to javascript - despite the fact that I knew I
couldn't do it!
Still, I learnt a bit about Javascript yesterday
> > I posted a while ago about generating page numbers
>> eBay-style for multiple result pages. I'd rather do
>> this in javascript on a per-page basis than do it
>> with Witango, and this is as far as I've got:
>>
>> <HEAD>
>>
>> <SCRIPT LANGUAGE="JAVASCRIPT">
>> function GoToPage( id )
>> {
>> window.location = (
>>
>'http://www.bolide.co.uk/actions/image.taf?link=&start='
>> + id);
>> }
>> </SCRIPT>
>>
>> </head>
>>
>> <BODY>
>>
>> <!----------------- nav bar starts here
>> ------------------>
>>
>> <a href="javascript: GoToPage('1');">1</A> | <a
>> href="javascript: GoToPage('11');">2</A> | <a
>> href="javascript: GoToPage('21');">3</A>
>>
>> <!------------------ nav bar ends here
>> ------------------->
>>
>> etc, etc
>>
>> What I'd like to do is to calculate the number of
>> pages from <@TOTALROWS> / <@NUMROWS>, round this
>> total up, then use javascript to populate the nav
>> bar automagically with the right numbers, and
>> calculate the record number to start from from
>> <@NUMROWS>
>>
>> The id number is the page number, and the start
>> record = ((page number x <@NUMROWS>)-(<@NUMROWS>-1))
>>
>> The final wrinkle would be to make the current page
>> number bold
>>
>>
>>
>> I know I can't do the javascript - can anyone help?
>> I'll post the completed, tested code back to the
>> list. The final results would be applicable across
>> the board for any dynamically-generated pages
>>
>________________________________________________________________________
>> TO UNSUBSCRIBE: send a plain text/US ASCII email to
>> [EMAIL PROTECTED]
> > with unsubscribe witango-talk in the
>> message body
>
>
>__________________________________________________
>Do you Yahoo!?
>Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
>http://mailplus.yahoo.com
>________________________________________________________________________
>TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
> with unsubscribe witango-talk in the message body
________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
with unsubscribe witango-talk in the message body