JavaScript - Confounding Issue With My Script!
Hey there! This code I am posting is used for some tests I'm doing with PHP and AJAX. What I find absolutely confusing is that when I add the refreshDir() function to any of the other functions, so that it runs once they have done their buisness, it absolutely screws up what-ever function I have it in. For instance if I have it running in the deleteTheFile() function. It prevents it from deleting the file. That function works perfectly fine when the refreshDir() function is not in it. Any hints or solutions? Please let me know if you'd like to see any of my other code. I'm posting the page's code along with the JS file and the Delete the file php page that deletes the files (there are other php files that create and read files). This whole thing was meant to be a simple exercise, but I am entirely confused as to why the refeshDir() function is screwing up everything. I don't think that the issue is related to anything else other than the javascript / ajax. Thanks for your help!
Here is the JS file: Code: if (window.XMLHttpRequest){ ajaxRequest=new XMLHttpRequest(); } else{ alert('Try again gold star!'); } var createResponse = 'Created Successfully'; var deleteResponse = 'Deleted Successfully'; var i = 0; function refreshDir(){ ajaxRequest.onreadystatechange = function(){ if (ajaxRequest.readyState == 4 && ajaxRequest.status == 200){ document.getElementById('directory').innerHTML = ajaxRequest.responseText; } } ajaxRequest.open('GET', 'theReadDir.php', true); ajaxRequest.send(); } function createTheFile(file){ var file = document.getElementById(file).value; var textInput = document.getElementById('toBeInserted').value; ajaxRequest.onreadystatechange=function(){ if (ajaxRequest.readyState==4 && ajaxRequest.status==200){ document.getElementById('responseCreated').innerHTML = " " + createResponse; } } ajaxRequest.open("POST", "theCreator.php", true); ajaxRequest.setRequestHeader('Content-type','application/x-www-form-urlencoded'); ajaxRequest.send("inserted=" + textInput + '&file=' + file); // refreshDir(); } function readTheFile(file){ var file = document.getElementById(file).innerHTML; ajaxRequest.onreadystatechange=function(){ if (ajaxRequest.readyState==4 && ajaxRequest.status==200){ document.getElementById('responseRead').innerHTML = ajaxRequest.responseText; } } ajaxRequest.open('GET', 'theReader.php?file=' + file, true); ajaxRequest.send(); } function readTheFileEntered(file){ var file = document.getElementById(file).value; ajaxRequest.onreadystatechange = function(){ if (ajaxRequest.readyState==4 && ajaxRequest.status==200){ document.getElementById('responseRead').innerHTML = ajaxRequest.responseText; } } ajaxRequest.open('GET', 'theReader.php?file=' + file + '&dir=', true); ajaxRequest.send(); } function deleteTheFile(file){ var file = document.getElementById(file).value; alert(file); ajaxRequest.onreadystatechange = function(){ alert(0); if (ajaxRequest.readyState == 1 && ajaxRequest.status == 200){ alert(1); } if (ajaxRequest.readyState == 4 && ajaxRequest.status == 200){ document.getElementById('responseDeleted').innerHTML = ' ' + deleteResponse; document.getElementById('responseDeleted').innerHTML = ' ' + ajaxRequest.responseText; } } alert(2); ajaxRequest.open('GET', 'theDeleter.php?file=' + file, true); alert(3); ajaxRequest.send(); alert(4); refreshDir(); } function resetFeedback(response){ document.getElementById(response).innerHTML = ''; } /*function removeAlert(){ var t = setTimeout("resetFeedback('responseDeleted')", 2000); } function updateSatus(){ document.getElementById('createButton').innerHTML = 'Update'; i += 1; if (i > 1) createResponse = 'Updated Successfully'; var t = setTimeout("resetFeedback('responseCreated')", 2000); } */ Here is the main page code: Code: <html> <head> <script type="text/javascript" src="operations.js"></script> <style type='text/css'> .niceboy{ font-family: Arial, sans-serif; font-weight: bold; font-size: 13px; color: #fff; text-align: center; text-shadow: 0px 1px 0px #B7B7B7; background-image: -webkit-linear-gradient(top,#D1D1D1,#c9c9c9); border-color: #BABABA; border-style: solid; border-radius: 12px; border-width: 1px; padding-left: 8px; padding-right: 8px; line-height: 24px; display: inline-block; cursor: pointer; } .listing{ margin: 4px; width: 200px; padding-left: 15px; cursor: pointer; } .listingfile{ background-color:#f0f0f0; } .listingdir{ background-color:#e3e3e3; } #directory{ margin: 20px; } </style> </head> <body onLoad="refreshDir();"> File Name: <input type='text' id='file' /> <br /> <br /> File Contents: <input type='text' id='toBeInserted' /> <br /> <br /> <br /> <div class='niceboy' id='createButton' onclick='createTheFile("file");'> Create </div> <span id='responseCreated'></span> <br /> <br /> <div class='niceboy' onclick='readTheFileEntered("file")'> Read </div> <span id="responseRead"></span> <br /> <br /> <div class='niceboy' onclick='deleteTheFile("file");'> Delete </div> <span id = 'responseDeleted'></span> <br /> <br /> <div class='niceboy' onClick='refreshDir();'> Refresh </div> <div id='directory'> </div> <br /> <br /> </html> </body> Here's the theDeleter.php file: PHP Code: <?php $file = $_GET['file']; //$file = 'created-files/'. $file; echo $file; function delete($file){ unlink($file); echo 'Deleted Successfully'; } if (file_exists($file) && is_file($file)) delete($file); else echo 'whoa bro that file doesn\'t exist!'; ?> And here's the theReadDir.php: PHP Code: <?php $dir = new DirectoryIterator('/wamp/www/phpAjaxTest/'); foreach($dir as $file){ if (!$dir->isDot()){ $ft = filetype($file); if ($ft == 'dir'){ $format = '<div class=\'listing listing' . $ft . '\' id = \'' . $file . '\' onClick = "readTheFile(\'' . $file . '\'); refreshDir();">' . $file . '</div>'; echo $format; } else{ $format = '<div class=\'listing listing' . $ft . '\' id = \'' . $file . '\' onClick = "readTheFile(\'' . $file . '\');">' . $file . '</div>'; echo $format; } } } ?> Basically any of the other function's (the only one's that I'd want refreshDir() to run in would be the creating and deleting functions) break when I add the refreshDir() function. Similar TutorialsI'm trying to resize this to about 60% smaller... it's a live chat pop-up, but out of my realm to expertise... can anyone help? It's the pop-up on the website brandedgear.com after about 25 seconds. Thanks! <div style="FLOAT: left; WIDTH: 500px; BACKGROUND: #FFFFFF url(<{$_themePath}>images/mainbackground.gif) REPEAT; BORDER: SOLID 1px #bcb5a6;"> <div style="BACKGROUND: #FFFFFF url(<{$_themePath}>images/icon_proactiveuserbackground.gif) NO-REPEAT bottom left; BORDER: SOLID 1px #bcb5a6; MARGIN: 8px;"> <div style="TEXT-ALIGN: center;"><img src="<{$_themePath}>images/<{$_product}>.gif" border="0" align="absmiddle" /></div> <HR align="center" style="WIDTH: 80%; BORDER: none; COLOR: #bcb5a6; BACKGROUND-COLOR: #bcb5a6; HEIGHT: 1px; MARGIN-TOP: 10px; MARGIN-BOTTOM: 3px;" /> <div style="PADDING-LEFT: 120px; TEXT-ALIGN: left; MARGIN-TOP: 30px; HEIGHT: 80px; FONT: 45px Trebuchet MS, Georgia, Verdana, Arial, Helvetica; COLOR: #333333;"> <{$_language[proactivetitle]}> </div> <div style="PADDING-LEFT: 120px; VERTICAL-ALIGN: top; MARGIN-TOP: 0px; PADDING-TOP: 0px; HEIGHT: 200px; FONT: 18pt Trebuchet MS, Georgia, Verdana, Arial, Helvetica; COLOR: #776849;"> <{$_language[proactivemsg]}><br /> <div style="PADDING-TOP: 30px; PADDING-LEFT: 80px; TEXT-ALIGN: center;"><div style="BORDER: SOLID 0 #FFFFFF; TEXT-ALIGN: center; BACKGROUND: URL(<{$_themePath}>images/proactivebutton.gif) no-repeat; HEIGHT: 37px; WIDTH: 135px; COLOR: #000000; FONT-WEIGHT: bold; FONT-FAMILY: Trebuchet MS, Georgia, Helvetica, Verdana, Tahoma; FONT-SIZE: 16px; MARGIN: 0px; PADDING-TOP: 6px; PADDING-BOTTOM: 15px; VERTICAL-ALIGN: middle; CURSOR: pointer;" onmouseover="this.style.color='red';" onmouseout="this.style.color='#000000'" onclick="javascript:doProactiveRequest_<{$_randomSuffix}>();"><{$_language[proactivechatnow]}></div></div> </div> </div> </div><div style="FLOAT: left; MARGIN-LEFT: -8px; MARGIN-TOP: -8px;"><a href="javascript:closeProactiveRequest_<{$_randomSuffix}>();"><img src="<{$_themePath}>images/icon_close.png" border="0" align="absmiddle" /></a></div> Hello Everyone! I'm new to JavaScript. I thought of learning by doing instead of just reading tutorials and books. So I started writing a Greasemonkey script for Facebook. Basically what it does is it creates a link to download photo albums from Facebook. I'm far from finished but anyway, here's my code so far. The format of the HTML code block where the URLs of pics are. Code: <div class="tagWrapper"> <i style="background-image: url(https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/299595_10150290138650735_543370734_8021370_355110168_a.jpg);"></i> </div> And here's my script so far, Code: var picURL; var modURL; var URLset = []; for(var i=0; i<picURL.length; i++) { //gets all the URLs in the page picURL = document.getElementsByClassName("tagWrapper")[0].children[0].style.backgroundImage; modifyURL(picURL); URLset.push(modURL); //inserting them to an array alert(URLset) ; } function modifyURL(); { //doing the replacements to make them downloadable modURL = picURL.replace("url(", "").replace(")", ""); modURL = modURL.replace("a.jpg", "n.jpg"); var dwn = "?dl=1"; modURL = modURL.concat(dwn); return modURL; } I have created a fiddle so that it all would be clearer. Since I'm half way through it, I just want to make sure it works up to this point so I have put an alert box to show all the modified URLs stored in the array. (supposed to, at least) the problem is, it isn't showing up. Can anyone please tell me what I have done wrong here? Bare with me for I'm new to this as I've mentioned earlier. Any help in teh right direction would be much appreciated. Thanks in advance. I'm admittedly green in this area [among others!], but will there be any issues with any browsers loading the url below with the scripts at the bottom of the page like I have them? http://alton.k12.mo.us/index.html FF loads them fine for me, as does IE *until* I hit the compatibility mode button, then it seems to sort of "hang"...but with IE, I'm not really ever sure of what it's doing is correct or not? I am having an issue with this script I wrote. Actually it works the way it is now, but not the way I want it too. This is a random raffle ticket number generater. The guys at the fire department where talking about selling 300 tickets and discussing how they were going to select and call the numbers. It got me thinking and inspired to start messing around with javascript again. It all starts with index.html and a form w/ a button and textarea. When a user clicks the button it will generate a random number and insert it into the textarea. This is accomplished by the Generate(); function that is in Genny.js an external js file. Code: <h2>Raffle Ticket Number Generator</h2> <form name="theform"> <input type="button" name="pickNumber" value="Pick a Winner" onclick="Generate();" /> <br /><br /> <textarea cols="40" rows="25" name="winnersCircle">Winning Numbers Will Display Here! </textarea> </form> This much works just fine. Now onto Genny.js Code: //initialize counter and array count = 1; winners = new Array(); function Generate(){ //generate a random number from 0-300 var random_number = Math.floor(Math.random()*301); //checks output of Math.random() against winners array to see if number has been used already for (i = 0; i < winners.length; i++ ) { if ( winners[i] == random_number ) alert("I am so sorry... we have accidently drawn a duplicate number! Please pick again."); } //add the number to the array winners[count] = random_number; //increment the counter count++; //display the stored random number document.theform.winnersCircle.value = winners.join("\n"); } This much works...somewhat! It generates the random number and checks the winners array to see if it is already used. If it wasn't used it adds the number to the array, increments the counter, and then displays the number in the textarea of the form, as it should. If the number was used it alerts the user, once the user clicks the button to accept the alert it carries on with the script and adds it to the array again and also displays it. This is not what I want it to do. If the number was used I do not want it added to the array or displayed. I would also like it to regenerate another number without the alert. The alert was wrote in to assist me in checking to see if it was finding a duplicate number, thats all. As an extra, is there a way to also add a numbered list to the results. To show the sequence of the ticket draw. I have messed with this for days and rewrote it over and over. I have used different loops and conditional operators to try and solve this problem. But to no avail. Here I am, asking not for the answer but a push in the right direction. Any help would be great, this is becoming an obsession trying to make it work. The code above is the last attempt at this point. Everything else has returned no values or just errors. Thanks in advance! This script isnt working. Im not sure what im doing wrong. forgive me i havent programmed in javascript before. titles.js Code: <script type="text/javascript" language="javascript"> <!--// function random_Title(){ if (parseInt(navigator.appVersion) >= 4) { var num = 3; var rantitle = new Array(num+1); rantitle[1] = "Random Title1"; rantitle[2] = "Random Title1"; rantitle[3] = "Random Title1"; ranNumber = parseInt(num * Math.random() + 1); document.title = rantitle[ranNumber]; } //--> } </script> html page Code: <html> <head> <script type='text/javascript' src='http://www.flashmajic.com/Google/titles.js'></script> <script> document.title = random_Title() ; </script> </head hi I am creating a gallery using my flickr feed. I have the bones of it working the only issue is with the thumbnail pulled from flickr. You get the option of small medium and large whicj Im using meduim. I want to add an image border around the thumbnails using a background image but when I add the styles it wont work. If i add a width to the img tag it will distrit the images because its being pulled from the flickr api anyone any ideas on how to get the background image working? html code is here Code: <body> <!-- Some Content --> <div id="gallery"> <input type='hidden' id='current_page' /> <input type='hidden' id='show_per_page' /> <div id="flickr"> </div> <div id='page_navigation'></div> </div> </body> CSS for the img is Code: [.hidden { display: none; } div#flickr a.lightbox img { border: 5px solid #b3aaa4; margin-left: 5px; margin-right: 5px; margin-bottom:30px } and the java script is here Code: $(function() { $.getJSON('http://api.flickr.com/services/rest/?format=json&method='+ 'flickr.photos.search&api_key=' + apiKey + '&user_id=' + userId + '&tags=' + tag + '&per_page=' + perPage + '&jsoncallback=?', function(data){ var classShown = 'class="lightbox"'; var classHidden = 'class="lightbox hidden"'; $.each(data.photos.photo, function(i, rPhoto){ var basePhotoURL = 'http://farm' + rPhoto.farm + '.static.flickr.com/' + rPhoto.server + '/' + rPhoto.id + '_' + rPhoto.secret; var thumbPhotoURL = basePhotoURL + '_m.jpg'; var mediumPhotoURL = basePhotoURL + '.jpg'; var photoStringStart = '<a '; var photoStringEnd = 'title="' + rPhoto.title + '" href="'+ mediumPhotoURL +'"><img src="' + thumbPhotoURL + '" alt="' + rPhoto.title + '"/></a>;' var photoString = (i < showOnPage) ? photoStringStart + classShown + photoStringEnd : photoStringStart + classHidden + photoStringEnd; $(photoString).appendTo("#flickr"); }); $("a.lightbox").lightBox(); }); }); anyone? I tried posting the code but it's too long... Page address: http://professorcuddlecore.com/paintings/ Problem: Click first or second photo, pops up fine, bottom text is behind the photo. You can view the JS by viewing source etc, sorry I can't fit it here. I spent 2-3 hours trying to figure out the problem but I'm new to JS and it looks like pretty convoluted code I'm using (obviously didn't write it myself, it's by "PopBox.") Thanks for any time spent helping me, pre-appreciated. Hi Script Experts I am facing issue in below code for Brisilia time zone.(GMT-3). Issue comes in October month only. It is going tobig loop. I am not getting how Date object is behaving here. Thanks in advance Pranav Sharma *********************************** <script type="text/javascript"> var nDate; var nCurrentYear = 2011; var nCurrentMonth = 10; nYear=2011; nMonth=10; var date = new Date(nYear, nMonth-1, 1); document.write('Month:'+date.getMonth() +':CurrentMonth:'+nCurrentMonth); while (date.getMonth() == nCurrentMonth-1) { nDate = date.getDate(); document.write(date.toDateString()); date = new Date(nCurrentYear, date.getMonth(), date.getDate()+1); } </script> ********************************** Hi All, I have two scripts which I want to try and integrate. I am using a nice gallery script to show thumbnails which are appended to a an image wrapper which on click of the thumbnail shows the larger image in the image wrapper, I am trying to implement cloud zoom which is a plugin which uses image srcs to then point to an anchor href to show another larger zoom image either in the same place.. which is what I am trying to do or in another div beside. I have had to set me img srcs up in a certain way to easily enter some product details. and I need to try an manipulate the code to make it work to suit my file layout. I am using a var= images [ with a series of file locations and info such as below { src: 'romanticabride/thumbs/tn_Shauna.jpg', srcBig: 'romanticabride/images/Shauna.jpg', title: 'Shauna', longDescription: '<b><H1>Shauna</H1></b><br><b>Romantica Of Devon <br><br><h2>Sizes Available:</h2><br> 6 - 32.<b><br><b><br><b><b><b><H2>Colours Available:</h2><b><br>Various<br>Please Enquire Below<br><br><br><br><a href="mailto:tracy@cherishbridal.co.uk?subject=Web Enquiry Regarding Romantica Shauna Bridal Gown"class="enquiry rose glow" >Click To Enquire About This Item </a>' }, what I need is for cloud zoom to work when the main image wrapper is hovered over which means it will need to add a class or when the whichever srcBig: is hovered over it gets wrapped by href to make the script work . one of my pages is http://www.cherishbridal.co.uk/romaticabride.html the cloud zoom script is at http://www.professorcloud.com/mainsite/cloud-zoom.htm.. I am happy to share a jsfiddle with someone or explain further or post some code. Thank you in advance I have a script that works in seamonkey(my html editor) but when I use it in IE8 it says errors happen. Here's the code (the first line is on line 7 of the html file): Code: <script type="text/javascript"> function enlarge(imageNum) { var numToString = ""; if(parseInt(imageNum) < 10){ numToString = "0" + imageNum; } else { numToString = imageNum + ""; } window.open("images/LgScreenshot"+numToString+".jpg","Screenshot "+imageNum,"status=0,height=675,width=900,resizable=0"); } </script> And the errors: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB0.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; InfoPath.3; .NET CLR 3.0.30729) Timestamp: Wed, 10 Feb 2010 14:58:16 UTC Message: Object expected Line: 150 Char: 1 Code: 0 URI: http://samssc2site.co.cc/Features.html Message: Invalid argument. Line: 18 Char: 1 Code: 0 URI: http://samssc2site.co.cc/Features.html does any expert know how to pass parameters in the <script ..> tag? for instance; Code: <script type="text/javascript" src="script.js ?param1=val1¶m2=val2&etc "> in the javascript script.js, how would we read the params after the question mark? for example, google this; google shopping cart /v2_2/cart.js 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 On this website: http://evancoleman.net/index.php I really like on the top how the menu has like 5 or 6 icons, and when you hover over them it shows a bubble with the name in them. Does anybody know where I can find this script? Thanks. Hello again . If these questions concerning Regular Expressions are inappropriate in this forum please let me know . Thank You. This expression <script[^>]*>.*?</script> matches ... Code: <script type="text/javascript">var cnnIsHomePage = true;</script> but not ... Code: <script type="text/javascript"> var cnnIsHomePage = true; </script> Please , how can i match the latter ? I have the following sample html file (attached). I am trying to display the calculated field using javascript and I created a function (I am a newbie) to do so. However, it persistently shows NaN instead of the required number. I have tried my best over a coupla hours racking my brains and the internet as to why it shows as not a number. I will appreciate any help. Thanks, Freaking IE. Must die. Really it must. Unfortunately, I have to code for it, and I can't figure out what went wrong he http://wyqued-design.com/dev/skyview/index.html The navigation, and layout, breaks in IE 7. Any ideas? -Emilie hi, i am trying to get some javascript working on a website i am making. the javascript changes the background image behind a photo. this simulates a user selecting a different frame from the drop down list http://jimpicot.com/shop/index.php?m...&products_id=3 below is the link to another forum it have been using to get most of the website working. http://www.zen-cart.com/forum/showthread.php?t=173765 For some reason I can not get this code to dump the information I type in into the mysql database...I'm sure I've missed something but can't seem to figure it out on my own. The mysql username & password are correct on my end & the fields match the mysql table column names. Do I have the code to connect & insert the fields into the mysql database in the correct place?? <?php # Page: add.php ########################## # Report all errors ########################## ini_set('display_errors',1); error_reporting(E_ALL); if( isset($_POST) && !empty($_POST) ) { # db connection settings ########################## # server IP $host = "localhost"; # sql user $user = "user"; # sql pw $pw = "mypassword"; # sql database $db = "psrflow"; # connect to db server ########################## $conn = mysql_connect( $host, $user, $pw ) or die( "Error! Unable to connect to database server: <br/>" . mysql_error() ); # connect to db ########################## $rs = mysql_select_db( $db, $conn ) or die( "Error! Unable to connect to database: <br/>" . mysql_error() ); # get submitted values & escape the text string foreach($_POST as $key=>$value) { ${$key}=mysql_real_escape_string($value); } $strSQL = "INSERT INTO psrinfo ( offender_fname, offender_lname, location, docket, officer, status, sent_date, assgn_date, interv_date, due_rev, due_suspo, due_clerk, due_attny, due_judge ) VALUES ( '" . $offender_fname . "', '" . $offender_lname . "', '" . $location . "', '" .$docket . "', '" .$officer ."', '" .$status ."', '".$sent_date ."', '".$assgn_date ."', '".$interv_date ."', '".$due_rev ."', '".$due_suspo ."', '".$due_clerk ."', '".$due_attny ."', '".$due_judge ."')"; # execute db insert ########################## if (!mysql_query( $strSQL, $conn )){ echo( "Unable to save data to database: <br/>" . mysql_error() . "<br/>" . $strSQL . "</span><br/>" ); } else{ header( "Location: index.html" ); exit; } } ?> <html> <head> <title>My Title</title> <script type="text/javascript"> var valid; function dcheck(form) { var a = form.assgn_date.value; var s = form.sent_date.value; var i = form.interv_date.value; var dr = form.due_rev.value var su = form.due_suspo var clk = form.due_clerk var att = form.due_attny var jdg = form.due_judge var assn = new Date(a); var sent = new Date(s); var intv = new Date(i); var due_rev = new Date(dr); var due_suspo = new Date(su); var due_clerk = new Date(clk); var due_attny = new Date(att); var due_judge = new Date(jdg); if (isNaN(assn)) { assn = new Date(sent.getFullYear(),sent.getMonth(),sent.getDate()+7); } if (isNaN(sent)) { sent = new Date(assn.getFullYear(),assn.getMonth(),assn.getDate()-7); } if (isNaN(intv)) { intv = new Date(sent.getFullYear(),sent.getMonth(),sent.getDate()+14); } if (isNaN(due_rev)) { due_rev = new Date(sent.getFullYear(),sent.getMonth(),sent.getDate()+15); } if (isNaN(due_suspo)) { due_suspo = new Date(sent.getFullYear(),sent.getMonth(),sent.getDate()+16); } if (isNaN(due_clerk)) { due_clerk = new Date(sent.getFullYear(),sent.getMonth(),sent.getDate()+17); } if (isNaN(due_attny)) { due_attny = new Date(sent.getFullYear(),sent.getMonth(),sent.getDate()+18); } if (isNaN(due_judge)) { due_judge = new Date(sent.getFullYear(),sent.getMonth(),sent.getDate()+19); } form.assgn_date.value = (assn.getMonth()+1) + "/" + assn.getDate() + "/" + assn.getFullYear(); form.sent_date.value = (sent.getMonth()+1) + "/" + sent.getDate() + "/" + sent.getFullYear(); form.interv_date.value = (intv.getMonth()+1) + "/" + intv.getDate() + "/" + intv.getFullYear(); form.due_rev.value = (due_rev.getMonth()+1) + "/" + due_rev.getDate() + "/" + due_rev.getFullYear(); form.due_suspo.value = (due_suspo.getMonth()+1) + "/" + due_suspo.getDate() + "/" + due_suspo.getFullYear(); form.due_clerk.value = (due_clerk.getMonth()+1) + "/" + due_clerk.getDate() + "/" + due_clerk.getFullYear(); form.due_attny.value = (due_attny.getMonth()+1) + "/" + due_attny.getDate() + "/" + due_attny.getFullYear(); form.due_judge.value = (due_judge.getMonth()+1) + "/" + due_judge.getDate() + "/" + due_judge.getFullYear(); return true; } </script> <style type="text/css"> body {background-color: #ffffff; margin-top: 60px;} </style> </head> <body> <form action="" method="get" onsubmit="return dcheck(this);"> <b>Docket No:</b> <br /> <input type="text" name="docket" size="30" /><br /> <b>First Name:</b> <br /> <input type="text" name="offender_fname" size="30" /><br /> <b>Last Name:</b> <br /> <input type="text" name="offender_lname" size="30" /><br /> <b>Status:</b> <br /> <input type="text" name="status" size="30" /><br /> <b>Location:</b> <br /> <input type="text" name="location" size="30" /><br /> <b>Officer:</b> <br /> <input type="text" name="officer" size="30" /><br /> <b>Sentence Date MM/DD/YYYY:</b /> <br /> <input type="text" size = "15" name="sent_date"> <br /> <b>Assign Date:</b>    <br /> <input type="text" size = "15" name="assgn_date"> <br /> <b>Invterview Date:</b>    <br /> <input type="text" size = "15" name="interv_date"> <br /> <b>Due to Reviewer:</b>    </br> <input type="text" size = "15" name="due_rev"> <br /> <b>Due to SUSPO:</b>    </br> <input type="text" size = "15" name="due_suspo"> <br /> <b>Due to Clerk:</b>    </br> <input type="text" size = "15" name="due_clerk"> <br /> <b>Due to Attorney:</b>    </br> <input type="text" size = "15" name="due_attny"> <br /> <b>Due to Judge:</b>    </br> <input type="text" size = "15" name="due_judge"> <br /> <br> <input type="button" value="Calculate" onclick="return dcheck(this.form);"> <input type="button" value="Reset" onclick="this.form.reset()"> <input type="submit" value="Submit" /> </form> </body> </html> Hello, I've got a strange image with mouse overs on a menu. my code; Code: function SwapImage(strName,strImage){ ImageFlip= new Image() ImageFlip.src = "images/" + strImage; var strImageOn = document.getElementById(strName); strImageOn.src = ImageFlip.src; return true; } <table border='0' cellpadding='5' cellspacing='5'> <tr> <td width='33' onMouseOver=\"SwapImage('MenuItem1','MouseOver.png');\" onMouseOut=\"SwapImage('MenuItem1','MouseOut.png');\"><a href='/'><img src='images/home_btn.png' border='0' /></a></td> <td width='11'><img src='images/MouseOut.png' border='0' id='MenuItem1' /></td> </tr> <tr> <td width='33' onMouseOver=\"SwapImage('MenuItem2','MouseOver.png');\" onMouseOut=\"SwapImage('MenuItem2','MouseOut.png');\"><a href='/artwork.php'><img src='images/artwork_btn.png' border='0' /></a></td> <td width='11'><img src='images/MouseOut.png' border='0' id='MenuItem2' /></td> </tr> <tr> <td width='33' onMouseOver=\"SwapImage('MenuItem3','MouseOver.png');\" onMouseOut=\"SwapImage('MenuItem3','MouseOut.png');\"><a href='/artists.php'><img src='images/artists_btn.png' border='0' /></a></td> <td width='11'><img src='images/MouseOut.png' border='0' id='MenuItem3' /></td> </tr> <tr> <td width='33' onMouseOver=\"SwapImage('MenuItem4','MouseOver.png');\" onMouseOut=\"SwapImage('MenuItem4','MouseOut.png');\"><a href='/about.php'><img src='images/about_btn.png' border='0' /></a></td> <td width='11'><img src='images/MouseOut.png' border='0' id='MenuItem4' /></td> </tr> <tr> <td width='33' onMouseOver=\"SwapImage('MenuItem5','MouseOver.png');\" onMouseOut=\"SwapImage('MenuItem5','MouseOut.png');\"><a href='/links.php'><img src='images/links_btn.png' border='0' /></a></td> <td width='11'><img src='images/MouseOut.png' border='0' id='MenuItem5' /></td> </tr> </table> this is in a php page, thats the reason for the extra slashes/espaces. for some reason, only the last row of the menu works with the mouse over, maybe I'm missing something, but it seems like it should all work. any ideas would be really helpful. cheers, -Ken Hello I have some JS email validation which does not appear to be working. I originally had a form and decided to add validation to it, so I am adding JS to that original file. My original form used this: Code: <form action="form_script.asp" method="POST" enctype="multipart/form-data" onSubmit="return onSubmitForm();"> and the validation script uses this: Code: <form name="theform" method="post" action="#" onSubmit="return check(this);"> I am trying to get them both to work. How would I do that, please? The test site is he http://proofreading4students.com/contact_test.asp Thanks for any help. Steve |