0

How can I display the popup below using the onclick method in JavaScript with a button?

 <div data-role="popup" id="myPopupDialog4">
    <a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a>

    <div data-role="header">
       <h4>Post Update </h4>
    </div>

    <div data-role="main" class="ui-content">
             <pre><B>
             <div id="resultDayOfWeek"></div>
             <div id="resultNum"></div>
             <div id="resultDir"></div>
             <div id="resultStop"></div>
             <div id="resultTime"></div>     
             </B> 
             </pre>
    <fieldset data-role="controlgroup">
        <legend>Choose Status</legend>

       <label for="Arrived/Left">Arrived/Left</label>
       <input type="radio" name="status" id="Arrived/Left" value="Arrived/Left">
       <label for="Delayed">Delayed</label>
       <input type="radio" name="status" id="Delayed" value="Delayed">  
       <label for="Canceled">Canceled</label>
       <input type="radio" name="status" id="Canceled" value="Canceled">
       <label for="getupdate">getupdate from others</label>
       <input type="radio" name="status" id="getupdate" value="getupdate">
       <label for="Other">Other</label>
       <input type="radio" name="status" id="Other" value="Other">
       </fieldset>

       <textarea name="addinfo" id="info"> Comments goes here.... </textarea>
       <input type="submit"  value="Submit" onclick="postSubmit();">  
       <div id="poststatus"></div>   
    </div>  

    <div data-role="footer" >
       <h1>Footer Text</h1>
    </div>

 </div>
1
  • Why do you mention jQuery in your title, but ask for JavaScript in your post? You don't need jQuery at all for this. Commented Mar 10, 2014 at 17:03

4 Answers 4

2

Just use window.open:

var referenceToNewWindow = window.open(url, name, features);
Sign up to request clarification or add additional context in comments.

Comments

0
function popup(mylink, windowname, w, h){
    if (! window.focus)return true;
    var href;
    if (typeof(mylink) == 'string')
       href=mylink;
    else
       href=mylink.href;
    window.open(href, windowname, "width="+w+",height="+h+",scrollbars=yes,toolbar=no" );
    return false;
}

 <a href="http://www.example.com"  onClick="return popup(this, 'Title', '400', '500')">Link</a>

1 Comment

where's popup defined?
0

Use This

<a href="" onClick="return popitup('http://www.abc.com/youpage')">Click Me</a>

Add following javascript script:

   <script>
   function popitup(url) 
   {
    newwindow=window.open(url,'name','height=300,width=650,screenX=400,screenY=350');
    if (window.focus) {newwindow.focus()}
    return false;
   }
   </script>

Comments

0

Stack Overflow Here is one exampe. check this

The javascript is below

<script>
        function openPopup() {
            document.getElementById("boxPopup").style.display = "block";
        }

        function closePopup() {
            document.getElementById("boxPopup").style.display = "none";
        }
        // When the user clicks anywhere outside of the modal, close it
        window.onclick = function (event) {
            var modal = document.getElementById('boxPopup');
            if (event.target == modal) {
                closePopup();
            }
        }

    </script>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.