Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8106637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:31:30+00:00 2026-06-06T00:31:30+00:00

My friend done this below coding for custom control <a href=javascript:__doPostBack(‘id’,’msg’);>click</a> now i want

  • 0

My friend done this below coding for custom control

<a href="javascript:__doPostBack('id','msg');">click</a>

now i want to show confirm dialog box while click this anchor link.

Is it possible?. i want to write script as inline.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:31:33+00:00Added an answer on June 6, 2026 at 12:31 am

    Do this :

    <a href="javascript:if (window.confirm('Really?')){__doPostBack('id','msg');};">click</a>
    

    But at some point, you’d want to stop using only inline code and have a look at other clearer ways to add javascript in your code.

    You may use a script block like this in the HEAD of your HTML file :

    <script>
        function doOnClick(){
           if (window.confirm('Really?')){
               __doPostBack('id','msg');
           };
        }
    </script>
    

    And then your link becomes

    <a href="javascript:doOnClick();">click</a>
    

    Of course, this doesn’t feel much simpler with only one function but it helps you put all your functions in the same place and make lighter and clearer html.


    An alternative would be to use jQuery, so that you may totally avoid putting javascript in the html part.

    The html is then

    <a id=myLink>click</a>
    

    And your script, now at the end of the body, is this one :

    <script>
       $(document).ready(function(){
           $('#myLink').click(function(){
               if (window.confirm('Really?')){
                   __doPostBack('id','msg');
               };
           });
    
           // other codes will come here
       });
    </script>
    

    You’re not at all required to code it this way now, as you only have a very light function, but if your code grows I suggest you start considering it and look at the jquery tutorials.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a Flex custom preloader, exactly like it is done in this
A friend of mine had a report done on an old site I built.
A friend gave me this code snippet in Clojure (defn sum [coll acc] (if
My friend made it so that on their page you can't right click on
I'm building a web application for my friend. He wants this application to be
I have rammed my head against this wall for a couple of days now
a friend of mine wrote this little progam. the textFile is 1.2GB in size
I have this code function check(){ $.get(friend.php, { id: friendid }, function(data){ //Do stuff
Hi was I hoping someone would help understand this behaviour of the below code.
Given an enum similar to this: Friend Enum TestValue As Int32 tstNotSet = -1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.