freakus_maximus Posted June 27, 2006 Share Posted June 27, 2006 I have this bit of code which will update the href with whatever is typed in the box (and navigated away from) using an onchange event. This is just a test script to get the function down.[code] <script type="text/javascript"> function update() { document.getElementById("link").href = document.f.s.value; return; } </script> <form name="f" ID="Form1"> <INPUT id="Text1" type="text" name="s" onchange="update();"> <a href="link1.php" id="link">Link</a> </form>[/code]This works fine, but not exactly what I need it to do.My real form has an input field that receives a date from a date picker, no problems there. This date is to be used as a variable in the href. But I cannot seem to figure out how to append the date selected to the href.So basically, my initial href value is (and will always be) "link1.php?datecompleted=" and I need it to be onchange "link1.php?datecompleted=06-27-06". (The formmated value 06-27-06 is all handled by the date picker when it dumps it into the input field.) Any ideas or help? I am a newb to javascript, so go easy. Quote Link to comment Share on other sites More sharing options...
nogray Posted June 27, 2006 Share Posted June 27, 2006 let's say the date variable is called "dt"[code]document.getElementById("link").href = "link1.php?datecompleted="+dt;[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.