JavaScript - Java Script Code Equivalent To This Php Code
Hi guys.. I really need a bit of help.. is anyone looking at this good with JS?
I have a php form validation script but i think its a bit slow and would rather a JS script instead... here is what i have in php.. PHP Code: <?php if(isset($_POST['submit'])) { $firstName = $_POST['firstName']; $lastName = $_POST['lastName']; $email = $_POST['email']; $mobile = $_POST['mobile']; $comments = $_POST['comments']; $errors = array(); function display_errors($error) { echo "<p class=\"formMessage\">"; echo $error[0]; echo "</p>"; } function validateNames($names) { return(strlen($names) < 3); } function validateEmail($strValue) { $strPattern = '/([A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4})/sim'; return(preg_match($strPattern,$strValue)); } function validateMobile($strValue) { $strPattern = '/^\d{10}$/'; return(preg_match($strPattern,$strValue)); } function validateComments($comments) { return(strlen($comments) < 10); } if(validateNames($firstName)) { $errors[] = 'Please Enter Your First Name'; } if(validateNames($lastName)) { $errors[] = 'Please Enter Your Second Name'; } if(!validateEmail($email)) { $errors[] = 'Please Enter Your Correct Email'; } if(!validateMobile($mobile)) { $errors[] = 'Please Enter Your Correct Mobile Number'; } if(validateComments($comments)) { $errors[] = 'Please Enter A Comment More Than 10 Characters'; } if(empty($errors)) { $to = "info@eventpromotion.ie"; $subject = "Event Promotion Enquiry!"; $body = "First Name: " . $_POST['firstName'] . "\nLast Name: " . $_POST['lastName'] . "\nEmail: " . $_POST['email'] . "\nMobile: " . $_POST['mobile'] . "\nMessage: " . $_POST['comments']; $headers = "From: ". $firstName ." ". $lastName . " <" . $email . ">\r\n"; if (mail($to, $subject, $body, $headers)) { echo("<p class=\"formMessage\">Thanks for submitting your enquiry.</p>"); } else { echo("<p class=\"formMessage\">Message delivery failed.</p>"); } } else { //echo "error"; display_errors($errors); } } ?> <form id="form" method="post" action="index.php#quickContact"> <p> <label>First Name</label><br /> <input type="text" name="firstName" value="<?php if(isset($firstName)){echo $firstName;} ?>" /> </p> <p> <label>Last Name</label><br /> <input type="text" name="lastName" value="<?php if(isset($lastName)){echo $lastName;} ?>" /> </p> <p> <label>Email:</label><br /> <input type="text" name="email" value="<?php if(isset($email)){echo $email;} ?>" /> </p> <p> <label>Mobile:</label><br /> <input type="text" name="mobile" value="<?php if(isset($mobile)){echo $mobile;} ?>" /> </p> <p> <label>Comments:</label> <br /> <textarea name="comments" cols="30" rows="3" ><?php if(isset($comments)){echo $comments;} ?></textarea> </p> <p> <input class="send" type="image" src="images/submit2.gif" name="submit" value="Submit" /></p> </form> does anyone know how to transfer this to JS so that it will be easy to understand.. Im not good with JS at all Similar Tutorialshello, i am looking a a specific javascript code for a school project. what the code does is it re-sizes your window to a specific size, and then makes it jump around to the four corners of your screen. a perfect example of this would be the rick roll site called http://www.20b.org/rickroll.html its best viewed in internet explorer, and will take effect after you allow it on the top pop up window. it seems that the latest version of firefox disables the window resizing and movement, so use IE. after examining the page source, i managed to find this code. window.resizeTo(640,625); window.moveTo(0,0); for (i = 1; i <= 9; i++){ setTimeout('window.moveTo(1599,1199);', i+"000"); i++; setTimeout('window.moveTo(0,1199);', i+"000"); i++; setTimeout('window.moveTo(1599,0);', i+"000"); i++; setTimeout('window.moveTo(0,0);', i+"000"); } the code worked perfectly on the macs used at school. but however, when i took it home and tried it on my PC, which has a different sized monitor, it didnt work right. my copied code section seemed to jump off the edges of the screen, like it was using the size of a Macs monitor, yet the original website works fine. this led me to believe that the source code seems to find the size of the monitor and adjust the position of where it moves. i cant seem to find that part of the code. any help would be appreciated Hi First sorry for my bad English! may any one interpret the JavaScript code below for me? A Device code ( a "random number") and the DVD code gives an activation code! Each install time a random number and thus a new activation code! i works in cookie base manner! clear cookie couse program become unusable and another activation will be needed! I want to change random Number to a fix one so it Becomes constant and does not change regularly! and then no need for change activation code... Where do I change? I'm sure help ... best regards thanks ----------------------------------------------------------------------------------- <html> <head> <title>Activation</title> <script type="text/javascript" src="../js/ajax.js"></script> <script type="text/javascript"> var _0x8834=["\x72\x65\x70\x6C\x61\x63\x65","\x68\x72\x65\x66", "\x6C\x6F\x63\x61\x74\x69\x6F\x6E","\x73\x65\x72\x 69\x61\x6C","\x61\x63\x74\x69\x76\x61\x74\x69\x6F\ x6E\x43\x6F\x64\x65","\x72\x61\x6E\x64","\x73\x75\ x62\x73\x74\x72\x69\x6E\x67","\x4D\x6F\x62\x69\x55 \x70\x54\x6F\x44\x61\x74\x65\x5F\x33","\x4D\x6F\x6 2\x69\x55\x70\x54\x6F\x44\x61\x74\x65\x5F\x34","\x 4D\x6F\x62\x69\x55\x70\x54\x6F\x44\x61\x74\x65\x5F \x35","\x2E\x2E\x2F\x4D\x6F\x62\x69\x55\x70\x54\x6 F\x44\x61\x74\x65\x2E\x68\x74\x6D\x3F"];function GET(){var _0x84efx2={};var _0x84efx3=window[_0x8834[2]][_0x8834[1]][_0x8834[0]](/[?&]+([^=&]+)=([^&]*)/gi,function (_0x84efx4,_0x84efx5,_0x84efx6){_0x84efx2[_0x84efx5]=_0x84efx6;} );return _0x84efx2;} ;if(GET()[_0x8834[3]]!=undefined&&GET()[_0x8834[4]]!=undefined&&GET()[_0x8834[5]]!=undefined){var num=(parseInt(GET()[_0x8834[3]][_0x8834[6]](0,7))%5555)*(parseInt(GET()[_0x8834[5]]%30)+1);if(num==parseInt(GET()[_0x8834[4]])){setf(_0x8834[7],GET()[_0x8834[5]]);setf(_0x8834[8],GET()[_0x8834[3]]);setf(_0x8834[9],GET()[_0x8834[4]]);window[_0x8834[2]]=_0x8834[10];} ;} ; </script> </head> <body align="center"> <h1>Activation</h1> To get activation code visit*************<br> <script language="javascript"> if (GET()['serial']!=undefined) document.write('<br>Incorrect serial or activation code. Try again please!<br>'); </script> <form action="./activation.htm?" method="GET"> <table align="center"> <tr> <td>Device code:</td> <td><script language="javascript"> if (getf('rand_num')==undefined) setf('rand_num', Math.floor(Math.random()*9999)); var rand_num=getf('rand_num'); document.write(rand_num+'<INPUT TYPE="hidden" NAME="rand" VALUE="'+rand_num+'">'); </script></td> </tr> <tr> <td>Serial</td> <td> <input name="serial"></input></td> </tr> <tr> <td>Activation code</td> <td> <input name="activationCode"></input></td> </tr> </table> <input type='submit' value="Activate"></input> </form> </body> </html> Hello all,I have a website and I would like a pop-up window to promote a new website venture I have. I would like for the new website to open in a completely new window/browser when my members simply click on the index page (No link or Buttons).The code below does most of what I ask lol,but it.. 1.Only opens in a new tab (in same browser) while I would like for it to open in a completely new browser "full page" menu bar scroll tab and all. plus 2.It seems to open each and every time the page is clicked,which will be annoying to my members.I would only like for it to open 1 time per visitor every 24 hours or whenever cookies are cleared. Code: <html> <head> <script type="text/javascript"> function click_on() { window.open("URL HERE", "_blank"); } </script> </head> <body onclick="click_on()"> </body> </html> I am no expert at this,and my knowledge is very limited,so excuse me if this is a simple situation.Any help would be greatly appreciated. Thanks, Roco Hello, I am in the process of using the split function for splitting strings into an array. The problem I am dealing with is how to do this with local language. Not all languages us the space " " delimiter between words to write a phrase or sentence. I have a list of all of delimiters for english, japanese, chinese, korean in Decimal Code Point format. For example, the decimal code point equivalent for " " is 32. Is it possible to use the javascript split function with decimal code points? If not, how can I reformat them into a format that js would understand? Many thanks. 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> Ok, so i need help writing a java script that will look at a bunch of numbers and output the highest one so what i need is for it to do something like this. (A is my input value) (B is my output value) the (A) value will be constantly changing and with the script has to do is look at all of those values and output them to (b) if anyone knows how to do this i would be so grateful if they could write the code for me because i'm new to coding and i really need this to work. thanks. I am looking for help to develop a java code for my e-commerce site mini cart. I have looked locally (kijiji) and on Coding Forums market place and haven't received a great response. Either the person had other projects they were working on or they were trying to "sell" me more than what I was asking for (ie web and graphic design). I have a mini cart on my site that I would like to have a few specific features. I am hoping someone in this forum can help me out (as I have received wonderful help before!!) I need a javascript code/feature that will: - highlight the most recent item that has been added to slide down mini cart window - refresh the mini cart div content to update item count and price. On the site I am hosted on there is a built in feature to show how many items are in the cart and total price, but I don't know how to get it to update successfully - when slide down mini cart window refreshes it should'nt scroll to the top (if there is a scrollbar) ie: looking to implement a javascript: void (0) if possible - have the slide down minicart window appear for 5-10 seconds then automatically slide back up. (the visitor can also have the option to close the window before the 5 seconds) I would really appreciate any help with this. I find javascript hard and I have tried to learn it, but unfortunately I can't seem to grasp it . Hello, I'm making a Javascript implementation for my Java program. But I'm having a proplem. I want to call my own Java code from the Javascript script. Is that possible? Thanks, enderp Hi My website was recently ftp hacked and a file inserted into it - js.php - which seems to be some sort of advertising spam programme. Having spotted the file I have renamed it to hide it but lots of other sites are still referring into my site looking for this php file. What I would like to do is to *just* open a java alert box on the referring sites to alert the users that the site has been hacked and that they should notify the webmaster so that he can fix his site. The line referring into my site is - <script type="text/javascript" src="http://www.mysite.com/js.php"></script> Is this something simple to do? I know nothing about Java or PHP so need detailed help. Thanks John Can you place java code in an external javascript file (.js). For example can I do the following in my xx.js file. $(document).ready(function(){ <% execute some java code here %> ...execute some javascript code here... }) Can I do the above? Another question ... I know <% %> is to execute java code inside html. But what does <%-- - -%> mean? Thanks for any help. Hi there, I'm trying really hard to find the solution to this error I am getting in java. Im using blue j. I have a feeling its something other than just braces missing somewhere, I have looked carefully and I'm just having bad luck!! I cant proceed to the next stage of my code unless I get this bit perfected with no syntax errors. I really really appreciate someone helping me out. Code: import java.util.Scanner; import java.awt.Color; /** * Write a description of class stage2 here. * * @author (Gayethiri Guruthevan) * @version (Version 1.0) */ public class stage2 { public static void main(String[]args) { final int WIDTH = 500; // width of the sheet in pixels final int HEIGHT = 500; // height of the sheet in pixels int x; // the x-coordinate int y; // the y-coordinate String direction; // the direction chosen // Create a Scanner object for keyboard input. Scanner keyboard = new Scanner(System.in); // 1. Ask the user for the ant's x-coordinate System.out.print("Enter your ant's x-coordinate: "); x = keyboard.nextInt(); // 2. If the x-coordinate is outside the allowed range, // print an error message and exit if(x < 0 || x > WIDTH-1) { System.out.println("The x-coordinate must be between 0 and " + (WIDTH-1)); System.exit(-1); } // 3. Ask the user for the ant's y-coordinate System.out.print("Enter your ant's y-coordinate: "); y = keyboard.nextInt(); // 4. If the integer is outside the allowed range, // print an error message and exit if(y < 0 || y > HEIGHT-1) { System.out.println("The Y-coordinate must be between 0 and " + (HEIGHT-1)); System.exit(-1); } // 5. Ask the user for the direction System.out.print("Enter the direction the ant is facing: "); direction = keyboard.next(); System.out.print("How many steps should the ant take?: "); int numStepsToTake = keyboard.nextInt(); for(int i=0; i<numStepsToTake;i++) { if (direction.equalsIgnoreCase("DL")) { y+=1; x-=1; } else if (direction.equalsIgnoreCase("DR")) { y-=1; x+=1; } else if (direction.equalsIgnoreCase("D")) { y-=1; } if (direction.equalsIgnoreCase("U")) { x+=1; } else if (direction.equalsIgnoreCase("UR")) { y+=1; x+=1; } else if (direction.equalsIgnoreCase("UL")) { y+=1; x-=1; } else if (direction.equalsIgnoreCase("L")) { x-=1; } else if(direction.equalsIgnoreCase("R")) { x+=1; } else { System.out.println("That is incorrect please enter the right direction"); } // "Wrap" the x and y-coordinates if the ant has walked over the edge of the paper if(x < 0) { x += WIDTH; } else if(x > WIDTH-1) { x-=WIDTH; } if(y < 0) { y += HEIGHT; } else if(y > HEIGHT-1) { y-=HEIGHT; } //Here is the new method for antart. AntArt.init(WIDTH,HEIGHT,x,y); for(int i=0; i<numStepsToTake;i++) { int oldX = x; int oldY = y; Color paperColor = AntArt.getColor(x,y); antColor = nextColor(antColor,paperColor); AntArt.setColor(antColor); // Take a step direction = nextDirection(direction,antColor,paperColor); x = stepX(x,direction,WIDTH,HEIGHT); y = stepY(y,direction,WIDTH,HEIGHT); AntArt.paint(oldX,oldY); } AntArt.paint(x,y); System.out.println("The new x is " + x + " and y coordinate is " + y); } } } private static int stepx(int x, String direction, int WIDTH, int HEIGHT) { //this will be the answer int newx = x; // take a step in the right direction if(direction.equals("UR")) { newx += 1; } else if (direction.equals("R")) { newx += 1; } else if(direction.equals("DR")) { newx += 1; } else if(direction.equals("DL")) { newx -= 1; } else if(direction.equals("L")) { newx -= 1; } else if(direction.equals("UL")) { newx -= 1; } // "Wrap" the x and y-coordinates if the ant has walked over the edge of the paper if(newx < 0) { newx += WIDTH; } else if(newx > WIDTH-1) { newx -= WIDTH; } return newx; } } } private static int stepY(int y, String direction, int WIDTH, int HEIGHT) { // this will be the answer int newy = y; // take a step in the right direction if(direction.equals("UR")) { newy += 1; } else if (direction.equals("R")) { newy += 1; } else if(direction.equals("DR")) { newy += 1; } else if(direction.equals("DL")) { newy -= 1; } else if(direction.equals("L")) { newy -= 1; } else if(direction.equals("UL")) { newy -= 1; } // "Wrap" the x and y-coordinates if the ant has walked over the edge of the paper if(newy < 0) { newy += HEIGHT; } else if(newy > HEIGHT-1) { newy -= HEIGHT; } return newy; } } 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. Quote: <html> <body> <script type="text/javascript"> N = prompt ("Enter your Name", "") Q1 = prompt ("Enter your First grade", "") Q2 = prompt ("Enter your Second grade", "") Q3 = prompt ("Enter your Third grade", "") CS.toFixed() = parseInt(Q1) + parseInt(Q2) + parseInt(Q2)/3 M.toFixed() = prompt ("Enter your Major Exam", "") M.toFixed() = ((CS.toFixed()*.6) + (M.toFixed()*.4)) document.write ("Your grade is " + CS.toFixed() + M.toFixed()) </script> </body> </html> My problem is i want the output to not show points (2.7, 3.3) The code works when i dont put .toFixed() on my code also it shows it on document.write but when i put .toFixed() on my code it doesnt show up on document.write already tinkering it for half an our now but i give up I need a java script code that can be installed in to my chrome (plugin) but all it will do is. Code: If (code) is display quite current tab. else if code isnt displayed leave tab open. The code would the zip code that is filled in on a page like this. http://www.locationary.com/place/en/...1023990998.jsp to see the code properly you need to sign in to the site (free sign up takes like 2 seconds) so if zip code is filled in then quit tab please any help on this would be great Hello, I have an html script and a .php script. The .php requests a random word from a table of words in a mysql database. I wrote a html form to display the requested word in a text box. Here is my html file: Code: <html> <body> <script type="text/javascript"> function myfunction() { var xmlhttp; if(window.XMLHttpRequest) { xmlhttp= newHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4) { document.myLingo.word.value=xmlhttp.responseText; } } xmlhttp.open("GET", "get_Word.php",true); xmlhttp.send(null); } </script> <form name="myLingo"> <input type="button" name="button" value="New Word" onClick="myFunction();" /> <input type="text" name="word" /> </form> </body> </html> and here is my .php script: Code: <?php $con=mysql_connect('localhost', 'xxxx', 'xxxx'); if (!$con) { die('Could not connect: '.mysql_error()); } mysql_select_db("my_lingo", $con); $sql=mysql_query("SELECT `word` FROM `words` ORDER BY RAND()") or trigger_error('Error: ' .mysql_error()); $word=mysql_fetch_array($sql); echo $word[0]; mysql_close($con); ?> When I run this in Internet Explorer; I get a error that is asking for an object on line 32 which is the line that has my button in the javascript. When i run it in firefox, I don't receive an error, but the page still does nothing. Any suggestions? The main function of the page is that, when I click the button, it's supposed to return me a random word from the .php script Thanks, jcjst21 Hello All, So, I have a website with a floating cart and it loads fine and works almost flawlessly lol. However, when a person has a bunch of items in their cart, and they want to minimize it for the rest of their browsing experience, every time a new page loads, or a refresh happens, the floating cart un-minimizes and expands out fully again displaying all the items. This can become very annoying during the shopping experience when you have a bunch of items loading and just taking up space in the browser. Therefore, I am wondering if their is some html or script that would save the minimizing in the floating cart, and carry it over to the next page, and the rest of the browsing on site? Thank you for any suggestions/help. I am new to HTML and script writing, but I am eager to learn. Hopefully in the future, I won't be paying for little changes like this every time I need one. Hi, Please i am not getting clear understanding of a javascript code to redirect user to a different web page based on the day of the week. Please i have search for many script and not getting clear understanding from their code.I have also try several code myself but nothing good has come from it. Please can someone help me and write a descriptive code for me to understand better.I really plead you and your to help me...but i belief the Lord God will bless you for your time helping me. looking forward to here from you. Thank you. Clement Osei 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. I need to assign a key in the javascript to actually make the javascript work,. I have a bookmark in chrome , a javascript , which actually works when clicked on it .,. but how can i edit it so that i can actually make it work on click a key or combination of keys. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. Thanks in advance ., Nani I am trying to set up a looping structure that tests to see if the user enters a value. If the textbox is null then a global variable is false otherwise a checkbox is checked and the global variable is true. below is what i have done so far, please assist me. var isValid = false; window.onload = startForm; function startForm() { document.forms[0].firstName.focus(); document.forms[0].onsubmit = checkEntries; alert("You have been added to the list") } function checkEntries() { var menus = new Array(); var formObject = document.getElementsByTagName('*'); for (var i=0; i < formObject.length; i++){ if (formObject[i] == "myform") menus.push(formObject[i]); if (document.forms[0].firstName.value.length==0 || document.forms[0].firstName.value.length == null){ isValid= false; alert("Please enter a first name"); } else (document.forms[0].check0.checked=true); isValid=true; if (document.forms[0].lastName=="" || document.forms[0].lastName== null){ alert("Please enter a last name"); isValid = false; } else (document.forms[0].check1.checked=true); isValid=true; if (document.forms[0].email=="" || document.forms[0].email== null) { alert("Please enter a valid email"); } else return (document.forms[0].check0.checked=true); isValid=true; if (document.forms[0].bDate=="" || document.forms[0].bDate== null) { isValid=false; alert("please make sure you enter a valid birth date."); } else (document.forms[0].check0.checked=true); isValid=true; } } here is the form html... <form name="myform" > <input type="checkbox" name="check0" class="check0" id="check0" > First: <input type="text" name="firstName" id="firstName"> <BR> <input type="checkbox" name="check1" class="check1" id="check1" > Last: <input type="text" name="lastName" id="lastName" ><BR> <input type="checkbox" name="check2" class="check2" id="check2" > E-Mail: <input type="text" name="email" id="email"> <BR> <input type="checkbox" name="check3" class="check3" id="check3" > Birthday (mm/dd/yyyy): <input type="text" name="bDate" id="bDate"> <BR> <input type="submit" value="Join our mailing List" /> </form> |