Solved

Java script (ShowConfirm) does not show in Firefox browser

Posted on 2010-11-14
13
700 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

708 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

13 Experts available now in Live!

Get 1:1 Help Now