JavaScript - Shortening Code To Make It Faster?
Hi, i have this code that works, but takes like 3 seconds to load when using it on the website. Is there a better way to code this to make it faster?
Code: function onTaskChange(num) { if( num = 1) { var stask = document.forms[0].task11.value; setSelectValue("forms[0].task21", stask); setSelectValue("forms[0].task31", stask); setSelectValue("forms[0].task41", stask); setSelectValue("forms[0].task51", stask); for( i = 0; i < 7; i++) tblProjectHours[i][6]=stask; onTaskChange(4); onTaskChange(7); onTaskChange(10); onTaskChange(13); } else if( num = 2) { var stask = document.forms[0].task12.value; setSelectValue("forms[0].task22", stask); setSelectValue("forms[0].task32", stask); setSelectValue("forms[0].task42", stask); setSelectValue("forms[0].task52", stask); for( i = 7; i < 14; i++) tblProjectHours[i][6]=stask; onTaskChange(5); onTaskChange(8); onTaskChange(11); onTaskChange(14); } else if( num = 3) { var stask = document.forms[0].task13.value; setSelectValue("forms[0].task23", stask); setSelectValue("forms[0].task33", stask); setSelectValue("forms[0].task43", stask); setSelectValue("forms[0].task53", stask); for( i = 14; i < 21; i++) tblProjectHours[i][6]=stask; onTaskChange(6); onTaskChange(9); onTaskChange(12); onTaskChange(15); } else if( num = 4) { var stask = document.forms[0].task21.value; for( i = 21; i < 28; i++) tblProjectHours[i][6]=stask; } else if( num = 5) { var stask = document.forms[0].task22.value; for( i = 28; i < 35; i++) tblProjectHours[i][6]=stask; } else if( num = 6) { var stask = document.forms[0].task23.value; for( i = 35; i < 42; i++) tblProjectHours[i][6]=stask; } else if( num = 7) { var stask = document.forms[0].task31.value; for( i = 42; i < 49; i++) tblProjectHours[i][6]=stask; } else if( num = 8) { var stask = document.forms[0].task32.value; for( i = 49; i < 56; i++) tblProjectHours[i][6]=stask; } else if( num = 9) { var stask = document.forms[0].task33.value; for( i = 56; i < 63; i++) tblProjectHours[i][6]=stask; } else if( num = 10) { var stask = document.forms[0].task41.value; for( i = 63; i < 70; i++) tblProjectHours[i][6]=stask; } else if( num = 11) { var stask = document.forms[0].task42.value; for( i = 70; i < 77; i++) tblProjectHours[i][6]=stask; } else if( num = 12) { var stask = document.forms[0].task43.value; for( i = 77; i < 84; i++) tblProjectHours[i][6]=stask; } else if( num = 13) { var stask = document.forms[0].task51.value; for( i = 84; i < 91; i++) tblProjectHours[i][6]=stask; } else if( num = 14) { var stask = document.forms[0].task52.value; for( i = 91; i < 98; i++) tblProjectHours[i][6]=stask; } else if( num = 15) { var stask = document.forms[0].task53.value; for( i = 98; i < 105; i++) tblProjectHours[i][6]=stask; } } Similar TutorialsHello. When a user first visits /index.html, they select their city. On later visits, I redirect them to their city (ie. /vancouver.html). The script seems to run slowly, and loads the whole /index.html for a second before redirecting. How can I make it faster? I have tried placing my code 1) in the head just below the title, 2) in the head before anything else, 3) in <body onload="..."> Code: function redirect() { userCity = readCookie ("user_city"); if (userCity) { window.location.replace(userCity + ".html"); } } Could I use something like if (navigator.cookieEnabled) to run the redirect() function if cookie detected and somehow cancel loading the rest of index.html? (if no cookie, or not enabled, still load index). Or is their a more standard way? I am a novice and really appreciate any help. How do I make my Script load faster? Is there Code that will make my Script load faster, (so that it won't take so long to view) If so, can someone show me how to incorporate it into my Example Script? With appreciation I have a single webpage that contains information on all 50 U.S. states. There are 50 links at the top to jump down to the state you want, and at the bottom of the information for each state a Back to Top link. I'm making the Back to Top link into something more complex, and it will require three or four lines of code. So that I don't have to repeat the code 50 times, and create a burden when I need to edit it, I want to place it in a .js file and call it x. Then below the information for each state I'll simply have: Code: <script language="JavaScript">document.write(x)</script> Does calling code from a .js file 50 times slow down the page load? Which method would load faster? Or is the difference negligible? Thank you, Peter Hey everyone. I have a simple hide/show script that is doing what I want, but I was wondering if there is an easier way around having to specify show and hide requirements "onclick" each time. Here is what I've got: Javascript: Code: <script type="text/javascript"> function show(boxid) { document.getElementById(boxid).style.display="block"; } function hide(boxid) { document.getElementById(boxid).style.display="none"; } </script> HTML: Code: <body onload="hide('homePoster1'); hide('homePoster2'); hide('homePoster3'); hide('homePoster4'); hide('filmDesc1'); hide('filmDesc2'); hide('filmDesc3'); hide('filmDesc4'); "> <div id="homePoster1"><img src="img/posters/babystory.gif" width="419" height="419" /></div> <div id="homePoster2"><img src="img/posters/converse.gif" width="419" height="419" /></div> <div id="homePoster3"><img src="img/posters/cookingchannel.jpg" width="419" height="419" /></div> <div id="homePoster4"><img src="img/posters/culturesofresistance.jpg" width="419" height="419" /></div> <div class="filmDescAll"> <h2>Film 1 title</h2> <div id = "filmDesc1">Film 1 description</div> <div class="more"><a href="#" onclick="show('filmDesc1'); hide('filmDesc2'); hide('filmDesc3'); hide('filmDesc4'); show('homePoster1'); hide('homePoster2'); hide('homePoster3'); hide('homePoster4');">+ more info</a></div> </div> <div class="filmDescAll"> <h2>Film 2 title</h2> <div id="filmDesc2">Film 2 description</div> <div class="more"><a href="#" onclick="show('filmDesc2'); hide('filmDesc1'); hide('filmDesc3'); hide('filmDesc4'); show('homePoster2'); hide('homePoster1'); hide('homePoster3'); hide('homePoster4');">+ more info</a></div> </div> <div class="filmDescAll"> <h2>Film 3 title</h2> <div id="filmDesc3">Film 3 description</div> <div class="more"><a href="#" onclick="show('filmDesc3'); hide('filmDesc1'); hide('filmDesc2'); hide('filmDesc4'); show('homePoster3'); hide('homePoster1'); hide('homePoster2'); hide('homePoster4');">+ more info</a></div> </div> <div class="filmDescAll"> <h2>Film 4 title</h2> <div id="filmDesc4">Film 4 description</div> <div class="more"><a href="#" onclick="show('filmDesc4'); hide('filmDesc1'); hide('filmDesc2'); hide('filmDesc3'); show('homePoster4'); hide('homePoster1'); hide('homePoster2'); hide('homePoster3');"class="more4">+ more info</a></div> </div> I've written a function that "condenses" a string if it is too long. Code: function shortenMsg(msg,maxLen){ if (msg.length > maxLen){ var over = msg.length - maxLen, // amount that needs to be trimmed method1 = (msg.match(/,\s/g) || []).length, // amount that method1 can trim method2 = (msg.match(/\]\s\[/g) || []).length; // etc... method3 = (msg.match(/demonstration/gi) || []).length * 6, // etc... if (method1 >= over){ msg = msg.replace(/,\s/g, ","); } else if (method2 >= over){ msg = msg.replace(/\]\s\[/g, "]["); } else if (method3 >= over){ msg = msg.replace(/nstration/gi, ""); } else { // optimal combination of 2+ methods } } return msg; } var longMsg = "...", shortMsg = shortenMsg(longMsg, 50); // example usage Each of the methods 1-3 is the amount that that specific method can trim from the string. I'd like to be able to trim as little as possible. For example, if the string needs 5 characters to be trimmed, and method1 can trim 8 characters, but method3 can trim 6, then method3 should be used. If none of the methods can individually trim the string enough, then I'd like the optimal combination of the methods that will get the job done. I can't figure out what sort of code structure I need for this (besides a ton of if/else statements). Maybe an array that contains each of the methods, arranged in increasing order....? Help would be appreciated! Sorry for posting so much recently Hi guys, first of all im sorry cause i dont know the javascript name and what should this call. i wanted to make a Helps and Guides look like this website http://fnatic.com/ Feedback that located on the left side. If can totally make like them then i hope the script can open a new window with custom size and address bar. I hope someone can help me... i will change my topic tittle if i know what is this call. sorry im a pure newbie in web programming. hopes you all can help me. thanks alot. just started learning scripting. This bookmarklet essentially takes the domain name of the tab currently open when one pressses it & runs a search query through Google prefixing the related: search operator. As evident, here it shows the result in the same page replacing the earlier one. I would like it to open in a new tab. Can you please tell me how to do so. Self-learning it. At an initial stage of learning, I am. Code: javascript:location.href='https://www.google.com/search?q=related%3A'+encodeURIComponent(location.host) I have this javascript code in this html page and it works fine. As soon as I try to add it to an existing page, it doesn't work. I have tried every position for the form and the script that I can think of but to no avail. I would greatly appreciate soon expert guidance. Frank. The code page is here. The page that I am trying to add it to is here. I have the google analytics code but it is presenting itself as not valid. Code: <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try{ var pageTracker = _gat._getTracker("UA-xxxxxx-x"); pageTracker._trackPageview(); } catch(err) {} </script> Can anyone help? ALso is this script suitable to link to externally? Hello, I want to run video at our website at a specified time only,like i might want my video to be played at 9.00a.m exactly . how can i do it using javascript. Plz do revert back ASAP. Thanks, Revathi srikrishna I have some code that will check a users screen resolution and open a new window with a particular version of my website in, I have several sites for different page sizes. But when this code runs in Safari the pop-up is blocked so I would like the image on my page to be a button that runs the code to open the 'correct' window (based on the screen res) and as a button is launching the new window Safari should be okay about it. Unless I am doing something wrong? http://www.meta.projectmio.com/pop.html But how do I modify the code to do this, I'm hopeless? Thanks. So I have made a website that you need a password to get into. The following javascript code works in Internet Explorer but, I need it to work in Safari also. Can anyone please rewrite this code, as simple as possible, to work in both Safari and Internet Explorer ? [CODE ]<!--// function mainpass() { if (pass.value=="password") {location="correct.HTML"}; else{location="wrong.HTML"}; } //--> [/CODE] Thanks in advance... I am trying to divide two numbers, display the value, then display what the value means. I am newbie, and trying to teach this to myself. I have the division displaying in a input box with a name of "total". I want to have the value from "total" display in an input box with a name of "interpretation". Do I use "c" or "total" to call the value? To write out "interpretation" do I use document.write, document.interpretation.write.? Code: <!doctype html> <html><head><title>ABI</title> <script language="javascript" type="text/javascript"> function division(){ var a=Number(document.calculator.number1.value); var b=Number(document.calculator.number2.value); var c=a/b; document.calculator.total.value=c; } } function interpretABI() { if (total >= 1) { document.write.interpretation("normal"); } else if ((total < 1) && (c >= 0.5)) { interpretation = "lower extremity and arterial insufficiency"; } else (total< 0.5) { interpretation = "severe ischemia"; } return interpretation; } } function division2(){ division() interpretABI() } </script> I have the code below that gives the ability to open and collapse sections. I don't know too much javascript and found this code online. I tweaked it to serve my purposes but it doesn't do one thing. I would like all of the areas to be collapsed when the page is opened. How would I tweak the code below to do that? Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Untitled Page</title> <script type="text/javascript"> function ExpandCollapseTable1(titleRow) { if(titleRow.parentNode.childNodes.length > 1) { if(titleRow.parentNode.childNodes[1].style.display=="block" || titleRow.parentNode.childNodes[1].style.display=="") { for(var i=1;i<titleRow.parentNode.childNodes.length;i++) { titleRow.parentNode.childNodes[i].style.display = "none"; } } else { for(var i=1;i<titleRow.parentNode.childNodes.length;i++) { titleRow.parentNode.childNodes[i].style.display = "block"; } } } } function ExpandCollapseTable2(titleRow) { if(titleRow.parentNode.childNodes.length > 1) { if(titleRow.parentNode.childNodes[1].style.display=="block" || titleRow.parentNode.childNodes[1].style.display=="") { for(var i=1;i<titleRow.parentNode.childNodes.length;i++) { titleRow.parentNode.childNodes[i].style.display = "none"; } } else { for(var i=1;i<titleRow.parentNode.childNodes.length;i++) { titleRow.parentNode.childNodes[i].style.display = "block"; } } } } function ExpandCollapseTable3(titleRow) { if(titleRow.parentNode.childNodes.length > 1) { if(titleRow.parentNode.childNodes[1].style.display=="block" || titleRow.parentNode.childNodes[1].style.display=="") { for(var i=1;i<titleRow.parentNode.childNodes.length;i++) { titleRow.parentNode.childNodes[i].style.display = "none"; } } else { for(var i=1;i<titleRow.parentNode.childNodes.length;i++) { titleRow.parentNode.childNodes[i].style.display = "block"; } } } } function ExpandCollapseTable4(titleRow) { if(titleRow.parentNode.childNodes.length > 1) { if(titleRow.parentNode.childNodes[1].style.display=="block" || titleRow.parentNode.childNodes[1].style.display=="") { for(var i=1;i<titleRow.parentNode.childNodes.length;i++) { titleRow.parentNode.childNodes[i].style.display = "none"; } } else { for(var i=1;i<titleRow.parentNode.childNodes.length;i++) { titleRow.parentNode.childNodes[i].style.display = "block"; } } } } </script> </head> <body> <table border='0' bordercolor='#000000' width='100%' cellspacing='0' cellpadding='0' bgcolor=red> <tr onclick="ExpandCollapseTable1(this);" style='cursor:pointer;'> <td> I</td> </tr> <tr> <td><table border='0' bordercolor='#000000' width='100%' cellspacing='0' cellpadding='0' bgcolor=lightgreen> <tr onclick="ExpandCollapseTable2(this);" style='cursor:pointer;'> <td> A</td> </tr> <tr> <td><table border='0' bordercolor='#000000' width='100%' cellspacing='0' cellpadding='0' bgcolor=yellow> <tr onclick="ExpandCollapseTable3(this);" style='cursor:pointer;'> <td> i</td> </tr> <tr> <td><table border='0' bordercolor='#000000' width='100%' cellspacing='0' cellpadding='0' bgcolor=lightblue> <tr onclick="ExpandCollapseTable4(this);" style='cursor:pointer;'> <td> a</td> </tr> <tr> <td bgcolor=orange> CONTENT CONTENT CONTENT</td> </tr> </table></td> </tr> </table></td> </tr> </table></td> </tr> </table> </body> </html> FYI, I've also posted this question at: http://www.tek-tips.com/submitpost.cfm?pid=216 http://www.webdeveloper.com/forum/sh...60#post1106660 Okay, so I built up 2 codes, which do the same cause. but which one would be most efficient? or maybe which one would be best compatible for browsers? CODE 1 : - this code allows for me to use an #id Code: <a onclick="trackClick('1');" href="http://www.google.com" rel="nofollow" target="_new">(track 1)</a> function trackClick(trackid) { ajax = ajaxFunction(); var url = base_url+ "app_trackClicks.php"; url = url+ "?trackid=" +trackid; ajax.open("GET",url,true); ajax.send(null); } CODE 2 - using the REL Code: <a rel="randomclicks" href="http://www.google.com" rel="nofollow" target="_new">(track 2)</a> function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function'){ window.onload = func; } else { window.onload = function(){ oldonload(); func(); } } } addLoadEvent(randomclicks); function randomclicks() { if (!document.getElementsByTagName){ return; } var anchors = document.getElementsByTagName("a"); // loop through all anchor tags for (var i=0; i<anchors.length; i++){ var anchor = anchors[i]; if ((anchor.getAttribute("rel") == "randomclicks")){ anchor.onclick = function () { ajax = ajaxFunction(); var url = base_url+ "app_trackClicks.php"; url = url+ "?randomclicks"; ajax.open("GET",url,true); ajax.send(null); }; } } } Thanks here is the html code that i have PHP Code: <td valign="middle" valign="middle"> <input type="radio" name="gender" id="genderM" value="Male" /> Male <input type="radio" name="gender" id="genderFM" value="Female" /> Female </td> and here is the js funtion PHP Code: var $j = jQuery.noConflict(); function isValidEmail(str) { return (str.indexOf(".") > 2) && (str.indexOf("@") > 0); } function validateForm(){ var firstName; var lastName; var email; var mobile; var comment; var error; firstName = $j('#firstName').val(); lastName = $j('#lastName').val(); email = $j('#email').val(); mobile = $j('#mobile').val(); comment = $j('#comment').val(); if(firstName=='' || firstName.length < 3){ error = 'Please Enter Your First Name'; $j('#errormsg').html('<p class="errors">'+ error +'</p>'); return false; } if(lastName=='' || lastName.length < 3){ error = 'Please Enter Your Second Name'; $j('#errormsg').html('<p class="errors">'+ error +'</p>'); return false; } //mob //$jmob_pattern = '^\d{10}$j'; if(mobile.length != 10 || isNaN(mobile)){ error = 'Please Enter Your Mobile Number'; $j('#errormsg').html('<p class="errors">'+ error +'</p>'); return false; } if(email=='' || !isValidEmail(email)){ error = 'Please Enter Your Email Address'; $j('#errormsg').html('<p class="errors">'+ error +'</p>'); return false; } if(comment.length < 5){ error = 'Please Enter A Comment'; $j('#errormsg').html('<p class="errors">'+ error +'</p>'); return false; } return true; } Does anybody know how i check to see if the radio button is select and also can anybody tell me how i can check for an email in the correct format the function isValidEmail in the above alows emails to pass through if they are in this format aaa@aaa. i only want them to go through if they are aaa@aaa.com Thanks for your help if you give it This post will contain a few guidelines for what you can do to get better help from us. Let's start with the obvious ones: - Use regular language. A spelling mistake or two isn't anything I'd complain about, but 1337-speak, all-lower-case-with-no-punctuation or huge amounts of run-in text in a single paragraph doesn't make it easier for us to help you. - Be verbose. We can't look in our crystal bowl and see the problem you have, so describe it in as much detail as possible. - Cut-and-paste the problem code. Don't retype it into the post, do a cut-and-paste of the actual production code. It's hard to debug code if we can't see it, and this way you make sure any spelling errors or such are caught and no new ones are introduced. - Post code within code tags, like this [code]your code here[/code]. This will display like so: Code: alert("This is some JavaScript code!") - Please, post the relevant code. If the code is large and complex, give us a link so we can see it in action, and just post snippets of it on the boards. - If the code is on an intranet or otherwise is not openly accessible, put it somewhere where we can access it. - Tell us any error messages from the JavaScript console in Firefox or Opera. (If you haven't tested it in those browsers, please do!) - If the code has both HTML/XML and JavaScript components, please show us both and not just part of it. - If the code has frames, iframes, objects, embeds, popups, XMLHttpRequest or similar components, tell us if you are trying it locally or from a server, and if the code is on the same or different servers. - We don't want to see the server side code in the form of PHP, PERL, ASP, JSP, ColdFusion or any other server side format. Show us the same code you send the browser. That is, show us the generated code, after the server has done it's thing. Generally, this is the code you see on a view-source in the browser, and specifically NOT the .php or .asp (or whatever) source code. I'm trying to get my Client Side Firefox DHTML app to display a list of eBooks. For this, i have the following files F:\Textbooks.html F:\eBooks.txt F:\FirstBook.txt F:\SecondBook.txt F:\ThirdBook.txt textbooks.html is my DHTML app eBooks.txt is the Library file with a listing of all of my eBooks. Inside of eBooks.txt is the following data: ----------------- FirstBook.txt, SecondBook.txt, ThirdBook.txt, ----------------- FirstBook.txt to ThirdBook.txt are my actual ebooks. The problem that i'm having is that When i try to click on any buttons other than the FirstBook button, i get the following error: ---------------------------------- Error: unterminated string literal Source File: file:///F:/Textbooks.html Line: 1, Column: 10 Source Code: LoadEbook(' ---------------------------------- So, unlike clicking on the FirstBook button, these other buttons do not load the eBook data into the DIV for displaying the eBook data. I use the DOM insepector to checkout the DOM of the button code, and it seems like whitespace maybe is the problem. However, i have removed whitespace from the HTMLdata string, and that's not fixing the problem. did i forget something silly? LOL i'm using FireFox 3.5 to develop this App. So obviously this will not work with anything other than Gecko Based browsers. here is my HTML code: <html> <head> <script language="JavaScript"> var eBookLibrary = "eBooks.txt"; var SystemPath = "f:" + String.fromCharCode(92) function Init() { // Initialize the eBook reader document.getElementById("EbookCanvas").style.visibility = "hidden"; document.getElementById("EbookToolbar").style.visibility = "visible"; document.getElementById("FileManager").style.visibility = "visible"; // Load the List of eBooks in the Library LoadBookList(); } function UpdateEbookList() { // Update the Library of Ebooks alert("Updating eBook Library"); // Go back to the File Manager, and Reload the List of Ebooks LoadBookList(); } function LoadBookList() { // This will load the list of books that are available var EbookList = LoadFromDisk(SystemPath + eBookLibrary); var EbookListArray = EbookList.split(","); for(var x = 0; x < EbookListArray.length -1; x++) { // Strip the Filename Extension off of the eBook File Name // The Name of the Book is always the first Index in the Array var BookName = EbookListArray[x].split("."); // Remove the weird whitespace - it screws things up...i think... BookName[0] = BookName[0].replace(/(^\s*|\s*$)/g, ""); var HTMLdata = HTMLdata + "<input type='button' value='" + "FirstBook" + "'" + " onClick=LoadEbook('" + EbookListArray[x] + "');><br>"; } // For some ****ed up reason the first string always generates an 'undefined' even though it's nonsense // So just delete that from the HTMLdata string, because it's just ugly - LOL HTMLdata = HTMLdata.replace("undefined", ""); HTMLdata = HTMLdata.replace("", " "); // Write the HTML data to the DIV document.getElementById("FileManager").innerHTML = HTMLdata; } function LoadEbook(EbookName) { // Hide the File Manager and Show the Ebook Canvas document.getElementById("FileManager").style.visibility = "hidden"; document.getElementById("EbookCanvas").style.visibility = "visible"; document.getElementById("EbookToolbar").style.visibility = "visible"; // Load the Ebook content into the Ebook Reader Pannel var EbookContent = LoadFromDisk(SystemPath + EbookName); document.getElementById("EbookCanvas").innerHTML = EbookContent; } function LoadFromDisk(filePath) { if(window.Components) try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); file.initWithPath(filePath); if (!file.exists()) return(null); var inputStream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream); inputStream.init(file, 0x01, 00004, null); var sInputStream = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream); sInputStream.init(inputStream); return(sInputStream.read(sInputStream.available())); } catch(e) { //alert("Exception while attempting to load\n\n" + e); return(false); } return(null); } </script> </head> <body onLoad="Init();"> <div id="FileManager" style="position: absolute; top: 0px; left: 0px; visibility: visible;"> The eBook Library's List of Books will be listed here. Click on one to open it in the eBook Reader </div> <br> <div id="EbookCanvas" style="position: absolute; top: 0px; left: 0px; visibility: hidden;"> </div> <br> <div id="EbookToolbar" style="position: absolute; top: 100px; left: 0px;"> <input type="button" value="Open" OnClick="Init();"> <input type="button" value="Update" OnClick="UpdateEbookList();"> <input type="button" value="Exit" OnClick="MainMenu();"> </div> </body> </html> Hi all, I hope someone can advise whether such a script exists for what am wanting to do. From time to time, I need to send password information or login details and password information to some users. At the moment, am doing it via email with a subject named FYI and the body of the email basically just contain the login and the password or in some case, just the password. What am wanting to know is whether I can put these information into a HTML file which contains an obfuscated Javascript with a button that a user will click that will prompt for his login information and then will display the password. In its simplest form, I guess I am looking for a Javascript that will obfuscate a HTML file that contains the password. Anyway, hopefully someone understand what am looking for. I found some website that offers such service as obfuscating a HTML file but am hoping it can be done via a Javascript so it is at least "portable" and I do not have to be online. Any advice will be much appreciated. Thanks in advance. |