views:

52

answers:

1

Hi friend! I have a master page which is having Javascript code which looks like this:

<script type="text/javascript">
 function ClientPrint(str)
    {  
              alert('before');
              PrintControl.RawPrint(str);            
              alert('after');

    }       
</script>

And the child form is calling this Javascript by the code

Page.ClientScript.RegisterStartupScript(Me.GetType, "jcr", "ClientPrint('" & StrFinalBill & "')", True)

This code is working absolutely fine in IE but not in anyother browser in Firefox error console I’m getting this error “printcontrol is not defined”.

Can anyone please help me?

A: 

IE supports refering to a node via its id. for firefox and other browsers use -

function ClientPrint(str)
{  
          alert('before');
          var PrintControl = document.getElementById(controlId); 
          PrintControl.RawPrint(str);            
          alert('after');

}       
Vinay B R
I tried but still no luck, i put alert after var line but it is not getting executed.
Yaser Ahmed
can u add a check to see if PrintControl is null. Also what is PrintControl
Vinay B R
Check if there are errors on the Error Console of firefox..
jerjer