Solved

Java script (ShowConfirm) does not show in Firefox browser

Posted on 2010-11-14
13
708 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

808 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