HI
I want to write a search for my site .I make a new panel in the left of my menue and it has a text input and an image which when that user click on it javascript opens a new window which is a php page.The part I don't know how to do is when the user click on the image it should get the content of the text input and pass it to the url.For the hyperlink of the image I use "<a href="javascript:open_window('includes/func/search.php?id=" But I don't know what should I write after that to get the content of the text input and put it in the next of the id.
How can I do so?

Thanks

Recommended Answers

All 3 Replies

Give the text-field an id (if you haven't, I'll use myTextField), then try this: <a href="javascript.open('includes/func/search.php?id='+encodeURIComponent(document.getElementById('myTextField').value)));">...</a>

Give the text-field an id (if you haven't, I'll use myTextField), then try this: <a href="javascript.open('includes/func/search.php?id='+encodeURIComponent(document.getElementById('myTextField').value)));">...</a>

Thanks for your reply but it doesn't work and when I clicked on it the url change to :javascript.open_window('includes/func/search.php?id='+encodeURIComponent(document.getElementById('pursue').value)));
Please help me how can I do so?
Thanks

Thanks for your reply but it doesn't work and when I clicked on it the url change to :javascript.open_window('includes/func/search.php?id='+encodeURIComponent(document.getElementById('pursue').value)));
Please help me how can I do so?
Thanks

Sorry, typo, there should be a colon after javascript and then window.open. Try <a href="javascript:window.open('includes/func/search.php?id='+encodeURIComponent(document.getElementById('myTextField').value));">...</a> . This is tested working in FF3.5

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.