Solved

copy from textbox form

Posted on 2009-04-03
4
548 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

726 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