By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,700 Members | 1,512 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,700 IT Pros & Developers. It's quick & easy.

how to append to URL ?

P: n/a
user input accepted via a input in the form.
this value needs to be appended to the current url (explained
below)

ie say present url is www.xyz.com and the user is asked
to enter his string and say he enters "john"
a hyper link needs to be created by appending this string, like
<a href="http://www.xyz.com/john"></a>
(the string "john" was the one input by the user in the input
field)
(where www.xyz.com is the current url)

it is easy to extract the value of the input field entered by the user
like document.forms[0].name1.value

how to use this value and append to the current url and then create a
new hyperlink with this appended string ?
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
This may help:-
http://artlung.com/lab/scripting/change_all_links/

this is to change all links, but if you know the position of th elink on
your page you can just use it's 'i' number.

Stu

"brian" <br*********@yahoo.com> wrote in message
news:af**************************@posting.google.c om...
user input accepted via a input in the form.
this value needs to be appended to the current url (explained
below)

ie say present url is www.xyz.com and the user is asked
to enter his string and say he enters "john"
a hyper link needs to be created by appending this string, like
<a href="http://www.xyz.com/john"></a>
(the string "john" was the one input by the user in the input
field)
(where www.xyz.com is the current url)

it is easy to extract the value of the input field entered by the user
like document.forms[0].name1.value

how to use this value and append to the current url and then create a
new hyperlink with this appended string ?

Jul 20 '05 #2

P: n/a
like:-

<a href="/0">Blah0</a>
<script language="javascript">
function appendlink()
{
// Change 2nd link link item in array (3rd on page, arrays start at 0)
document.links[2].href= document.links[2].href + "/" +
document.test.string.value;
return false;
}
</script>

<form name="test" onsubmit="return(appendlink());">
<input type="text" name="string">
<input type="submit">
</form>

<a href="/1">Blah1</a><br />
<a href="/2">Blah2</a> << This will be chnaged<br />
<a href="/3">Blah3</a><br />
<a href="/4">Blah4</a><br />
<a href="/5">Blah5</a><br />
<a href="/6">Blah6</a><br />

"Stuart Palmer" <tr**********@youcant.com> wrote in message
news:JA****************@newsfep2-gui.server.ntli.net...
This may help:-
http://artlung.com/lab/scripting/change_all_links/

this is to change all links, but if you know the position of th elink on
your page you can just use it's 'i' number.

Stu

"brian" <br*********@yahoo.com> wrote in message
news:af**************************@posting.google.c om...
user input accepted via a input in the form.
this value needs to be appended to the current url (explained
below)

ie say present url is www.xyz.com and the user is asked
to enter his string and say he enters "john"
a hyper link needs to be created by appending this string, like
<a href="http://www.xyz.com/john"></a>
(the string "john" was the one input by the user in the input
field)
(where www.xyz.com is the current url)

it is easy to extract the value of the input field entered by the user
like document.forms[0].name1.value

how to use this value and append to the current url and then create a
new hyperlink with this appended string ?


Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.