houssam_ballout Posted November 13, 2007 Share Posted November 13, 2007 Hello all,as for passing an argument in html page, I am using the following<a href="index.php?page=search_first.php&search=docum ent.search1.searchText.value" />I want to get the value from a text box to send it with the url so that I can use it in another page to search for it.but the upper one is not working?Do I make any mistake?Thanks in advance__________________ Link to comment Share on other sites More sharing options...
jesh Posted November 13, 2007 Share Posted November 13, 2007 If I'm not mistaken, your goal is to allow someone to type in a value into a text field and have that value be appended to the href of the link when the user clicks on that link?If that's the case, the simplist solution would be to add a onclick event handler to the link that appends the value of the text field to the href when someone clicks on the link: <a href="index.php?page=search_first.php&search=" onclick="this.href += document.getElementById('search1').value">Click ME!</a> Link to comment Share on other sites More sharing options...
Reg Edit Posted November 14, 2007 Share Posted November 14, 2007 Hello all,as for passing an argument in html page, I am using the following<a href="index.php?page=search_first.php&search=docum ent.search1.searchText.value" />I want to get the value from a text box to send it with the url so that I can use it in another page to search for it.but the upper one is not working?Do I make any mistake?Thanks in advance__________________The querystring will be set automatically if you place the textbox and other required fields in an html form. You could then use the link to execute some javascript which submits the form. Link to comment Share on other sites More sharing options...
jlhaslip Posted November 15, 2007 Share Posted November 15, 2007 docum entis there an extra space in there? Link to comment Share on other sites More sharing options...
SpOrTsDuDe.Reese Posted November 15, 2007 Share Posted November 15, 2007 The code has an extra space on there. That might be why it isn't working, you realize that right? the docum ent.search1 function isn't complete with the extra space between m and e Link to comment Share on other sites More sharing options...
Ingolme Posted November 15, 2007 Share Posted November 15, 2007 It wouldn't work anyways, the href attribute doesn't run javascript.Best use an HTML form like Reg Edit said. Link to comment Share on other sites More sharing options...
Synook Posted November 16, 2007 Share Posted November 16, 2007 It wouldn't work anyways, the href attribute doesn't run javascript.Unless you use the java script: pseudo-protocol. Link to comment Share on other sites More sharing options...
SpOrTsDuDe.Reese Posted November 16, 2007 Share Posted November 16, 2007 He's got a point Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.