lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev JS onclick


From: Patrick Boylan
Subject: Re: lynx-dev JS onclick
Date: Mon, 31 Jul 2000 11:37:24 -0700

In "Re: lynx-dev JS onclick"
[31/Jul/2000 Mon 09:22:59]
A. R. Vener wrote:

> What does javascript do with the index number? Is there an warray of
> URL's somewhere that it uses the index to reference one of them?   Where is
> the Javascript syntax documented?

Well, there are variables that let you define several alternate
links from one input.

Here's a New Array() script, which looks a *lot* like a client-side
image map to me.  Maybe it could be parsed in a similar way?

<HTML><HEAD><TITLE>Alphabet Soup</TITLE>
<!--
     Delete the comments if you want to save some load-time. 
     This new array script was only designed for images, but maybe
     you can add onClick variables to access pages.  Different,
     conditional links depending on which image is up?  Frames?
     FRAME SRC isn't too different from IMG SRC. . .
-->

<SCRIPT LANGUAGE="JavaScript1.1">
<!-- Begin hiding from older browsers
//   Oh, really?

var photos=new Array()
var which=0

// so now we know what photos means below.  Note the index numbers.

photos[0]="img/z_alphabet-soup.gif"

photos[1]="img/A_.gif"
photos[2]="img/B_.gif"
photos[3]="img/C_.gif"
//      . . .Predictable sequence. . .
photos[24]="img/X_.gif"
photos[25]="img/Y_.gif"
photos[26]="img/Z_.gif"

function backward(){
if (which>0){
window.status=''
which--
document.images.photoslider.src=photos[which]
}
}

// Lynx doesn't need to worry about function forward() or backward()
// It only needs to understand the file references.

function forward(){
if (which<photos.length-1){
which++
document.images.photoslider.src=photos[which]
}
else window.status='End of gallery'
}
// End hiding -->
</SCRIPT>


This is followed by a dummy form in the body with onClick='forward()'
and onClick='backward()'  I say it looks like a [USEMAP] because
of the listed references under the "photos" variable.

Something else, with a <SELECT> popup:

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function formHandler(form) {
var site2 = "site"
var windowprops = 
"width=600,height=*,location=yes,scrollbars=auto,menubars=no,toolbars=no,resizable=yes,status=yes,images=yes";
var URL = form.site.options[form.site.selectedIndex].value;
popup = parent.open(URL,"MenuPopup",windowprops);
//window.location.href = URL;
}
// End -->
</script></HEAD>
<BODY>
  <form name="form">
    <select name="site" SIZE="1" onChange="formHandler(this.form)">
        <option value="">Go to....
        <option value="00_sound_idx.html">Music Page
        <option value="sound/bark_at_moon.mid">0zzy 0sbourne, Bark at the Moon
        <option value="sound/cantina.mid">Star Wars, Cantina Tune
        <option value="sound/danse_macabre.mid">Danse Macabre
        <option value="sound/das_boot.mid">Yanni, Theme from Das Boot
        <option value="sound/Dr.Who.mid">Dr.Who Theme
[...]

The problem here is that onChange replaces the submit button [in
fact, a submit button would be pretty useless anyway, because
there's no CGI at the other end to return the file, and no form
action is defined].  I still think this could be parsed as a kind
of image map.  The presence of an onChange() function and a list
of URLs, plus a form without an action, might be enough for Lynx
to figure it out [given a *lot* of work, of course].

> Rudy
> 
> > PW> it really shouldn't be difficult to get Lynx to recognise `onclick',
> > PW> extract the following URL & present it as a link marked `ONCLICK':
> > > In many, if not most, of the cases I've seen, the URL is not
> > > in the onclick parameter.  What is there is either an index number,
> > > or only part of the relative URL; most commonly just an index number.
> > 
> > yes, that is true of the best public example i can offer.
> > to focus discussion, how could Lynx handle the document at
> >  http://www.gotransit.com/fare/fndfare.asp ,
> > where getting a point-point bus fare is prevented by a  [BUTTON] ?
> > the necessary URLs do seem to be present in the JS in the source,
> > but not necessarily in an easy-to-predict place.
> > anyone care to try the programming challenge?
> > 
> > -- 
> > ========================,,============================================
> > SUPPORT     ___________//___,  Philip Webb : address@hidden
> > ELECTRIC   /] [] [] [] [] []|  Centre for Urban & Community Studies
> > TRANSIT    `-O----------O---'  University of Toronto
> > 
> > ; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden
> > 
> 
> 
> ; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden
> 





                          Patrick
                <mailto:address@hidden>
 

; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]