Solved

Java script (ShowConfirm) does not show in Firefox browser

Posted on 2010-11-14
13
704 Views
Last Modified: 2013-11-23
Hello Experts,
On my web page i have  abutton that when a user clicks does invoke a java show confirm message. This message pops up when you are using IE browser but with Firefox it doesn't.
Anyone please shed some light on this
Thanks
0
Comment
Question by:jsuanque
  • 6
  • 4
  • 2
13 Comments
 

Author Comment

by:jsuanque
ID: 34132482
Here's my code...

    <script language="javascript"  type="text/jscript">
 
    function ShowConfirm(textBox)
    {
   
        var confirmtext ="Thank you! ...Your Registration number is: ";
        return confirm(confirmtext + textBox.value);
    }
    </script>
0
 
LVL 10

Expert Comment

by:hosneylk
ID: 34133124
how are you calling the function?
0
 

Author Comment

by:jsuanque
ID: 34133605
Hello Hosneylk,
On a button click.

Cheers,
0
 
LVL 10

Expert Comment

by:hosneylk
ID: 34133771
Can I see how? i.e. the code you are using to call the function.
0
 
LVL 11

Expert Comment

by:Manish
ID: 34135236
onclick="ShowConfirm(document.formName.textBoxName)"
0
 
LVL 11

Expert Comment

by:Manish
ID: 34135267
also check is javascript enable in mozilla.?
Edit> Preference> COntent...
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:jsuanque
ID: 34141329
Hello Karanw,
javascript is enabled. As for onclick currently our code does something ...
#################
                                <asp:Button ID="NSOEF_EXT_Preview_Form_Button" runat="server" BackColor="Silver" Font-Bold="True" Font-Names="Tahoma" Font-Size="Small" ForeColor="Black" Style="z-index: 186; left: 544px; position: absolute; top: 920px" Text="Print Preview" Width="96px" OnClick="Declaration_to_PrintPreviewt_BTN_Click"/>


#################

    protected void Declaration_to_PrintPreviewt_BTN_Click(object sender, EventArgs e)
    {
        con = new SqlConnection(ConfigurationManager.ConnectionStrings["STUDENT_MASTER_INDEXConnectionString"].ConnectionString);

        cmd = new SqlCommand("SMI_P003_NSOEF_EXT_Declaration_Main", con);
        cmd.CommandType = CommandType.StoredProcedure;

        cmd.Parameters.Add("@EnrolID", SqlDbType.VarChar).Value = NSOEF_EXT_Declaration_Back_EnrolID_TB.Text;
        cmd.Parameters.Add("@Active", SqlDbType.VarChar).Value = '1';
        cmd.Parameters.Add("@StuEmergCont1Title", SqlDbType.VarChar).Value = NSOEF_EXT_StuEmergCont1Title_DDL.Text;

        con.Open();
        cmd.ExecuteNonQuery();

        int newIdentity = int.Parse(cmd.Parameters["@EnrolID"].Value.ToString());
        Response.Redirect("NSOEFP_EXT_Print.aspx?newid=" + newIdentity.ToString());
0
 
LVL 10

Expert Comment

by:hosneylk
ID: 34141714
so where's the call to ShowConfirm?
0
 

Author Comment

by:jsuanque
ID: 34306399
Sorry guys for taking so long...can i request this not to be abandoned since i just got back from a motorcycle accident.
0
 

Author Comment

by:jsuanque
ID: 34306405
Hi Hosneylk/ Karanw,

Here's the one that calls it and it's included in Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        NSOEF_EXT_Preview_Form_Button.Attributes.Add("onclick", "return ShowConfirm(" + NSOEF_EXT_Declaration_EnrolID_TB.ClientID + ");");
0
 
LVL 10

Accepted Solution

by:
hosneylk earned 250 total points
ID: 34306839
you're missing the quotes when assigning the call to the button. and in your js function use document.getElementById to get the object 1st and then read the value of it.

btw the proper way to do this would be to add it to the event onclientclick of the button.
SOEF_EXT_Preview_Form_Button.Attributes.Add("onclick", "return ShowConfirm('" + NSOEF_EXT_Declaration_EnrolID_TB.ClientID + "');");



function ShowConfirm(textBox)

    {

        var tbObj = document.getElementById(textBox);

        var confirmtext ="Thank you! ...Your Registration number is: ";

        return confirm(confirmtext + tbObj.value);

    }

Open in new window

0
 

Author Closing Comment

by:jsuanque
ID: 34307554
Thanks Hosneylk,
It now works.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Any Third party toll for Integrating chat system on ASP.NET ? 2 34
Not showing page correctly 3 30
Turn on intranet settings 1 40
servlet example issue 6 31
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
The viewer will learn how to implement Singleton Design Pattern in Java.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now