Solved

copy from textbox form

Posted on 2009-04-03
4
547 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

856 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