M
Mark Anderson
Sorry if this is a rookie mistake... I've been through all the FAQs and the
books I have but I can't see the mistake so I guess it's something simple
<g> - I'm an occasional JS user.
I've got some code (in an external JS file) attached to a number of links
off a query result page. The code it checks if there are any ticked items on
the page and adds them to a lightbox (cart) before going the next called
result page. The idea is to stop the user taking any link off the page and
inadvertently remembering to add their selections to the lightbox.
The initial call is from a link, either to another result page in the same
query 'set' or to various static pages or predefined queries. The example
below is a call to load the lightbox (code my wrap):
<a href="#"
onclick="goWhere('LIGHTBOX','../scripts/portweb.dll?show&catalog=test&templa
te=lightbox','ADD',document.resultAdd);">Show Lightbox</a>
function goWhere(linkName,theURL,task,theForm) takes parameters for the type
of destination, the query string, the action (Add or Delete) for the
lightbox and the calling form. If there are no checked items (for adding to
the lightbox) on the page, the call falls through the various functions
passing back 'theURL' which is than set as the page is called as (code
excerpt):
var target = constructURL(linkName, theURL);
document.location.href = target;
Note - the query strings being used are otherwise fine and not, I believe,
the cause of the problem.
So, the code executes in a function in an external file. It words fine in
IE6 Win but in IE5 Mac and Safari 1 Mac it stops. It seems the location.href
is not being executed correctly and this is where the code breaks. It even
breaks if, as a test, I use
document.location.href = 'index.htm';
to point to a static page. The Mac browsers just don't seem to like
location.href.
Any pointers gratefully received,
Regards
Mark
books I have but I can't see the mistake so I guess it's something simple
<g> - I'm an occasional JS user.
I've got some code (in an external JS file) attached to a number of links
off a query result page. The code it checks if there are any ticked items on
the page and adds them to a lightbox (cart) before going the next called
result page. The idea is to stop the user taking any link off the page and
inadvertently remembering to add their selections to the lightbox.
The initial call is from a link, either to another result page in the same
query 'set' or to various static pages or predefined queries. The example
below is a call to load the lightbox (code my wrap):
<a href="#"
onclick="goWhere('LIGHTBOX','../scripts/portweb.dll?show&catalog=test&templa
te=lightbox','ADD',document.resultAdd);">Show Lightbox</a>
function goWhere(linkName,theURL,task,theForm) takes parameters for the type
of destination, the query string, the action (Add or Delete) for the
lightbox and the calling form. If there are no checked items (for adding to
the lightbox) on the page, the call falls through the various functions
passing back 'theURL' which is than set as the page is called as (code
excerpt):
var target = constructURL(linkName, theURL);
document.location.href = target;
Note - the query strings being used are otherwise fine and not, I believe,
the cause of the problem.
So, the code executes in a function in an external file. It words fine in
IE6 Win but in IE5 Mac and Safari 1 Mac it stops. It seems the location.href
is not being executed correctly and this is where the code breaks. It even
breaks if, as a test, I use
document.location.href = 'index.htm';
to point to a static page. The Mac browsers just don't seem to like
location.href.
Any pointers gratefully received,
Regards
Mark