Hello Hello, I hope this makes sense (and I'm posting in the right forum section). Here's what I'm trying to do. I'm trying to type a form where the user will type in a 4 to 7 digit number: <input type="text" name="id" value=""> <input type="submit" value="Submit"> Cool so far. But what I need is after they submit it, the value that is put in there is submitted as a customized link (not http). Example: If a user inputs 1234, it will be changed to clink://1234@example.com So the question is, how do get it so that the value submitted from the form is inserted in between my clink:// and @example.com? Once again, hopefully that makes sense. I'm not even sure what I should be searching for on the forums. Maybe replace string or something? I don't know and I apologize. Any help would be greatly appreciated! --Musei
<input type="text" name="id" id="clid" value=""> <input type="submit" id="clsubmit" value="Submit"> ... <script type="text/javascript"> window.onload = function() { document.getElementById("clsubmit").onclick = function() { var clid = document.getElementById("clid"), newValue = "clink://" + clid.value + "@example.com"; clid.value = newValue; }; }; </script> PHP: in action: http://mooshell.net/cSWqT/ stay clear of naming elements that you want to reference with names like 'name' or 'id' if you can, IE can cause some weirdness in accessing these elements or their respective name or id properties.
Super Cool. Now I just need it to go to the link. Update: So I added this: <form method="post" action=""> <input type="text" name="id" id="clid" value=""> <input type="submit" id="clsubmit" value="Submit"> </form> Which seems to clear the form (nice), but all it really does is refresh the same page I'm on. Looking up more info to try and figure this out.
Try: <form name="test" action="" method="get"> <input type="text" name="id" id="clid" value=""> <input type="submit" id="clsubmit" value="Submit"> </form> ... <script type="text/javascript"> window.onload = function() { document.getElementById("clsubmit").onclick = function() { var clid = document.getElementById("clid"), newValue = "clink://" + clid.value + "@example.com"; clid.value = document.forms['test'].action = newValue; }; }; </script> HTML: