1

I have a form with buttons on it. When I call the Javascript method using the onclick event of the button, it works in Google Chrome and Internet Explorer. But when I use Firefox, the onclick event of the button doesn't invoke the Javascript method.

function openHistory()
{
    window.open("frmCLogHistory.aspx?txtCLogID="+document.all['<%=txtCLogID.ClientID %>'].value, 'abc', 'fullscreen=no,top=10,left=100,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no, directories=no,location=no,width=800,height=630,titlebar=no');
}
</script>



<input type="button" name="showHistory" value="Show History"  
onclick="javascript:openHistory()" style="width:120px;"  class="GVButton" />
2
  • 5
    post some codes what you've tried so far Commented Apr 15, 2013 at 10:47
  • sachin i have shared the code.. Commented Apr 15, 2013 at 10:54

3 Answers 3

1

Try this

function openHistory()
{
  var element= document.getElementById('<%= txtCLogID.ClientID %>').value;
  window.open("frmCLogHistory.aspx?txtCLogID="+element, 'abc', 'fullscreen=no,top=10,left=100,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,   directories=no,location=no,width=800,height=630,titlebar=no');
}
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks it working perfect. The World is Gold if U R Bold!!!!
1

If the code works in Internet Explorer and Chrome, but not in Firefox, maybe there is a popup blocker working in Firefox that stops your window.open() call? Add some debugging code to your function, say:

function openHistory()
{
    alert('Firing window.open');
    window.open( <... url ... > );
}

See if you get the alert, which means your function is firing, and it's just the window.open() call that fails.

Comments

0

Update 1

Use as follows

 <input type="button" name="showHistory" value="Show History" class="GVButton"
     onclick="javascript:return openHistory()" style="width:120px;"  />

Java-Script Code

  function openHistory()
 {
    var pageName="frmCLogHistory.aspx?";
        pageName+="txtCLogID="+document.getElementById('<%=txtCLogID.ClientID %>').value;
    var options ="fullscreen=no,top=10,left=100,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,directories=no,location=no,width=800,height=630,titlebar=no";
    window.open(pageName,'abc',options);
   return false;
}

4 Comments

no ihave used the onclick event just check it by looking at code @Shekhar
document.all is a proprietary Microsoft extension to the W3C-standard. getElementById is standard - use that.
Since the button is not an asp:Button but a regular input type="button", there is no OnClientClick.
I did not downvote you, I only commented that it wasn't an ASP button.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.