Solved

copy from textbox form

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now