Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send a query string and it's value is textbox input

Status
Not open for further replies.

miroiti

Programmer
Jun 20, 2009
18
EG
hi all,
i just wanna to make a href and send a parameter with this href and this parameter is the input of a textbox.
here what i did:

Code:
<a href="1.html?title_edit='window.document.getElementById('ti').value'>Edit</a>
but it has a syntax error...i donot know where and why...?
 
Hi

Yepp. When you open a double quote ( " ) then close a single quote ( ' ), it is syntax error.

Anyway, you can not put HTML and JavaScript together. One is markup and is rendered, the other is code and is executed.

I would do it like this :
Code:
[b]<a[/b] [maroon]href[/maroon][teal]=[/teal][green][i]"1.html?title_edit="[/i][/green] [maroon]onclick[/maroon][teal]=[/teal][green][i]"this.href=this.href.replace(/([?&]title_edit=)[^&]*/,'$1'+document.getElementById('ti').value)"[/i][/green][b]>[/b]Edit[b]</a>[/b]

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top