Bato Dor
Bato Dor

Reputation: 841

Link doesnt work in FF

Here is the link:

<a href="javascript://" onClick="print_gonder();"><img src="/images/print.gif" title="Gönder" border="0"></a>

and its function print_gonder:

function print_gonder()
{
    var satirsayisi=document.list_basketww.row_count.value; 
    var amnt=new Array(satirsayisi);
    var prc=new Array(satirsayisi);
    var kdv=new Array(satirsayisi);
    var kon=new Array(satirsayisi);
    var yap=new Array(satirsayisi);
    var ona=new Array(satirsayisi);
    var ode=new Array(satirsayisi);
    var tes=new Array(satirsayisi);
    for (i=0; i<satirsayisi; i++)
    {   
        amnt[i]=eval("document.getElementById('amount" + (i+1) + "')").value;
        prc[i]=filterNum(eval("document.getElementById('price" + (i+1) + "')").value);
        kdv[i]=eval("document.getElementById('tax_dif" + (i+1) + "')").value;
        kon=eval("document.getElementById('konu')").value;
        yap=eval("document.getElementById('yapan')").value;
        ona=eval("document.getElementById('onay')").value;
        ode=eval("document.getElementById('odeme')").value;
        tes=eval("document.getElementById('teslim')").value;
    }
    windowopen('<cfoutput>#request.self#?fuseaction=objects2.popup_sale_propose&print=true#page_code#&amnt='+amnt+'&prc='+prc+'&kdv='+kdv+'&konu='+kon+'&yapan='+yap+'&onay='+ona+'&odeme='+ode+'&teslim='+tes+'</cfoutput>','page');
}

The problem is that this link doesnt work in FF but work in IE, but if i change the function into something like this:

<a href="javascript://" onClick="<cfoutput>windowopen('#request.self#?fuseaction=objects2.popup_sale_propose&print=true#page_code#','page')</cfoutput"><img src="/images/print.gif" title="Gönder" border="0"></a>

it perfectly works in all the browsers.. i think that the problem is in defining the values of the functions, the FF just doesnt understand them... btw, the system is Workcube and it uses the Cold Fusion.

Upvotes: 0

Views: 250

Answers (3)

Ben
Ben

Reputation: 57287

The onclick may be captured by the <img> child and not firing correctly. To fix, moving the event to the child element will probably work.

Try this:

<a href="#" >
  <img src="/images/print.gif" onClick="print_gonder();" title="Gönder" border="0">
</a>

Better yet, remove the <a> and just have the image be clickable. Add some CSS and you're on your way.

Upvotes: -1

mplungjan
mplungjan

Reputation: 178328

Please try this:

<a href="#" onClick="return print_gonder();"><img src="/images/print.gif" title="Gönder" border="0"></a>

and add

return false

to the end of the function


UPDATE trying to fix some more of the bad code:

function print_gonder() {
    var satirsayisi=document.list_basketww.row_count.value; 
    var amnt=[];
    var prc=[];
    var kdv=[];
    var kon=[];
    var yap=[];
    var ona=[];
    var ode=[];
    var tes=[];
    for (i=0; i<satirsayisi; i++) {   
        amnt[i]=document.getElementById('amount' + (i+1)).value;
        prc[i]=filterNum(document.getElementById('price' + (i+1)).value);
        kdv[i]=document.getElementById('tax_dif' + (i+1)).value;
        kon[i]=document.getElementById('konu').value;
        yap[i]=document.getElementById('yapan').value;
        ona[i]=document.getElementById('onay').value;
        ode[i]=document.getElementById('odeme').value;
        tes[i]=document.getElementById('teslim').value;
    }
    var url = '<cfoutput>#request.self#?fuseaction=objects2.popup_sale_propose&print=true#page_code#</cfoutput>';
    url += '&amnt='+amnt+'&prc='+prc+'&kdv='+kdv+'&konu='+kon+'&yapan='+yap+'&onay='+ona+'&odeme='+ode+'&teslim='+tes;
    windowopen(url,'page');
    return false;
}

Upvotes: 0

Shadow Wizzard
Shadow Wizzard

Reputation: 66388

Your code is utterly wrong in more ways than I can count here.

Have such thing instead:

var satirsayisi = parseInt(document.getElementById("row_count").value, 10); 

var amntArr = new Array();
var prcArr = new Array();
var kdvArr = new Array();

var kon = document.getElementById('konu').value;
var yap = document.getElementById('yapan').value;
var ona = document.getElementById('onay').value;
var ode = document.getElementById('odeme').value;
var tes = document.getElementById('teslim').value;

for (i = 0; i < satirsayisi; i++)
{   
    amntArr.push(document.getElementById('amount' + (i+1)).value);
    prcArr.push(document.getElementById('price' + (i+1)).value);
    kdvArr.push(document.getElementById('tax_dif' + (i+1)).value);
}

var amnt = amntArr.join(",");
var prc = prcArr.join(",");
var kdv = kdvArr.join(",");

This assume "row_count" is the ID of the input element with the count.

For the record, the direct reason it didn't work in FF is because it has no document.all stuff, you can't access DOM elements via the document directly.

Upvotes: 2

Related Questions