Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Java script (ShowConfirm) does not show in Firefox browser

Posted on 2010-11-14
13
Medium Priority
?
741 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

604 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