Sending textfield data to another page without using form

Hi,

Is it possible to send the content of a textfield to another page in javascript?
I mean the keywords passed to the next page should be as a parameter like 'keywords=text'
The textfield is outside the <form> tag.

thanks
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<input name="keywords" type="text" id="keywords">
<img src="images/btngo.gif" width="20" height="18">
</body>
</html>

Open in new window

azlan25Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:
Hi Azlan25,

You can use query string to pass the data across pages.

Here is an example that might help you.

http://eureka.ykyuen.info/2011/07/08/javascript-get-url-query-string/

Regards,
Rikin
0
Kim WalkerWeb Programmer/TechnicianCommented:
Something like this:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<input id="keywords" name="keywords" type="text" id="keywords">
<img src="images/btngo.gif" width="20" height="18" onclick="javascript: window.open('http://www.domain.com?x='+encodeURI(document.getElementById('keywords').value);">
</body>
</html>

Open in new window

0
azlan25Author Commented:
Hi. Thanks for your reply!

@xmediaman this is perfect except one isssue. The next page should open in the parent page.
So i've replaced 'window.open' with 'location.href' but in FF doesn't work.
 In IE works just fine
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Atique AnsariCommented:
<html>
<head>
<title>Page 1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script language="javascript">
      jQuery(document).ready(function(e)
      {
            $("img#pass_value").live('click', function(e)
            {
                  window.location = 'page_name.html?keywords=encodeURI'+$("#keywords").val();
            });
      });
</script>
</head>

<body>
<input name="keywords" type="text" id="keywords">
<img src="images/btngo.gif" width="20" height="18" id="pass_value">
</body>
</html>
0
Kim WalkerWeb Programmer/TechnicianCommented:
Curious. What does happen in FF? Did you add the id to your input tag?
0
Kim WalkerWeb Programmer/TechnicianCommented:
I had left out a closing parenthesis in my code. Your code should be:

<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<input id="keywords" name="keywords" type="text" id="keywords">
<img src="images/input_bkgd.png" width="20" height="18" onClick="javascript: window.location.href = 'http://www.domain.com?x='+encodeURI(document.getElementById('keywords').value);">
</body>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Kim WalkerWeb Programmer/TechnicianCommented:
You'll need to change the image url back to your own.
0
azlan25Author Commented:
Yep! That does it!
Thanks for your time
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.