Solved

copy from textbox form

Posted on 2009-04-03
4
546 Views
Last Modified: 2013-11-11
how could i copy from email textbox when submit ..it will redirect to contact page to fill the remaining but should copy the email which intered....

how could i achieve that???
0
Comment
Question by:saad220
  • 3
4 Comments
 
LVL 31

Expert Comment

by:RiteshShah
ID: 24136604
you can create one page eg: first.html and call below code.


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script language="javascript" type="text/javascript">
        function getEmailID() {
            var email = document.getElementById('txtEmailID').value;
            window.open('contact.html?email=' + email);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <input type=text id="txtEmailID" />
        <input type=button onclick="getEmailID()" />
    </div>
    </form>
</body>
</html>

Open in new window

0
 
LVL 31

Accepted Solution

by:
RiteshShah earned 250 total points
ID: 24136666
more refined code.

create one page named First.html and paste below code there in first.html

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script language="javascript" type="text/javascript">
        function getEmailID() {
            var email = document.getElementById('txtEmailID').value;
            window.open('contact.html?email=' + email);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <input type="text" id="txtEmailID" />
        <input type="button" onclick="getEmailID()" />
    </div>
    </form>
</body>
</html>



now create second page named contact.html and paste below code in that.

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function getEmail() {

            document.getElementById('txtEmailID').value = getQuerystring('email');
        }
        function getQuerystring(key, default_)
        {
          if (default_==null) default_="";
          key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
          var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
          var qs = regex.exec(window.location.href);
          if(qs == null)
            return default_;
          else
            return qs[1];
        }


    </script>
</head>
<body onload="getEmail()">
    <form id="form1" runat="server">
    <div>
<input type="text" id="txtName"/>        
<input type="text" id="txtEmailID" />
       
    </div>
    </form>
</body>
</html>

now you are done. run First.html, enter email in text box and click on button, there will be two text box in second page one is for name and another one is for email. You will get email text box already filled up.
0
 

Author Comment

by:saad220
ID: 24139746
thanks.

i am not using ASP i amean what is runat="server"??

could u make it in java script or php Please?

thanks

0
 
LVL 31

Expert Comment

by:RiteshShah
ID: 24139767
ohh sorry, remove Runat="Server" attribute, this is completely in Javascript no need of ASP or even PHP
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

823 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