@doug777authorFeb 25.2004 — #The code searches for span tags that surround a price on the page in the format either (for example)
<span>US$24.50</span>
or if an alternative currency has been already been selected
<span>A$40.00 (US$24.50)</span>
sym contains the currency symbol - US$ A$ etc.
rate contains the exchange rate for that symbol.
A button on the page pops up a small window where the currency can be selected. When the 'go' button is clicked in the currency selection window, the currency changes to the one selected with US$ in parentheses if US$ is not the selected currency.
In IE it works reliably with no problems but in Netscape when you click the go button, nothing happens and the window does not close.
This is the function on the main page called by the currency window:
function NewText(sym, rate) {
for (i=0;i<document.getElementsByTagName('span').length;i++){
var price = document.getElementsByTagName('span')[i].innerHTML;
if(price.indexOf('(') == -1) {
var firstnum=price.search(/d/);
var pricenum=price.slice(firstnum);
}
else {
var firstnum=price.search(/(/)+4;
var pricenum=price.slice(firstnum, -1);
price=price.slice(firstnum-3, -1);
}
if(sym == "US$") {
var newprice=sym+pricenum;
}
else {
var cvtprc=Math.ceil((((pricenum)*1.02)/rate)*100)/100;
@doug777authorFeb 25.2004 — #Many thanks for your replies, but regret still has same problem in Netscape, although works fine in IE (without var on the array element calls).
@KorFeb 25.2004 — #It might be a referenece problem also. NS needs complete referenece of the object, IE accept shortcuts (i.e. [i]id[/i].attribute or [i]name[/i].attribute), while NS needs all the tree, starting with document. or at least with form.)
1 what is jcurrarray? I don't see where is it set up as an array.
@doug777authorFeb 25.2004 — #Just wondering if the problem lies in the select code. I have used a button element for the 'go' button, and originally I thought it should be within <form> tags, but this didn't work in IE so I took them out.
Here is the code where customer chooses the currency: