Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: java script

  1. #1
    Junior Member
    Join Date
    Jun 2024
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default java script

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title></title>
    <style type="text/css">
    body
    {
    font-family: Arial;
    font-size: 10pt;
    }
    </style>
    </head>
    <body>
    <table border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td>
    Name:&nbsp;
    </td>
    <td>
    <input type="text" id="txtName" readonly="readonly" />
    </td>
    <td>
    <input type="button" value="Select Name" onclick="SelectName()" />
    </td>
    </tr>
    </table>
    <script type="text/javascript">
    var popup;
    function SelectName() {
    popup = window.open("Popup.htm", "Popup", "width=300,height=100");
    popup.focus();
    return false
    }
    </script>
    </body>
    </html>
    --------------------------------------------------------
    --------------------------------------------------------


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title></title>
    <style type="text/css">
    body
    {
    font-family: Arial;
    font-size: 10pt;
    }
    </style>
    </head>
    <body>
    <select name="ddlNames" id="ddlNames">
    <option value="Mudassar Khan">Mudassar Khan</option>
    <option value="John Hammond">John Hammond</option>
    <option value="Mike Stanley">Mike Stanley</option>
    </select>
    <br />
    <br />
    <input type="button" value="Select" onclick="SetName();" />
    <script type="text/javascript">
    function SetName() {
    if (window.opener != null && !window.opener.closed) {

    var txtName = window.opener.document.getElementById("txtName");
    txtName.value = document.getElementById("ddlNames").value;
    alert();
    }
    window.close();
    }
    </script>
    </body>
    </html>

    ----------------------------------------------------------------------

    Dear,

    I am not success this code,what is my problem.

    thanks
    Abrar

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,115
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: java script

    Can you explain what happens when you load that code into a browser?
    What browser are you using?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Jun 2024
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: java script

    Yes,when i run parent page and click popup and popup is open but popup not transfer the value parent page .

    var txtName = window.opener.document.getElementById("txtName");
    txtName.value = document.getElementById("ddlNames").value;
    alert();

    this code is not active

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,115
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: java script

    I don't know javascript that well. Try asking your question on this site:
    https://www.coderanch.com/f/20/HTML-...CSS-JavaScript
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Need help in a java script
    By aliva in forum Computer Support
    Replies: 1
    Last Post: March 23rd, 2022, 09:43 AM
  2. Replies: 2
    Last Post: July 9th, 2018, 07:02 AM
  3. Replies: 1
    Last Post: September 21st, 2014, 04:15 AM
  4. codecademy Java Script
    By TyffaN in forum Other Programming Languages
    Replies: 1
    Last Post: September 2nd, 2014, 08:47 AM