?
Solved

Java script (ShowConfirm) does not show in Firefox browser

Posted on 2010-11-14
13
Medium Priority
?
732 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
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 1000 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month13 days, 11 hours left to enroll

801 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