Jump to content

wagga2650

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

wagga2650's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi I have this script that I want to add a 2nd combo box and have it validate them. Can someone show me how to do it please. Here is the script below and thanks in advance for any suggestions <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>ComboBox Validation</TITLE> <script Language="JavaScript"> function validateR(){ var selectedCombobox=(comboForm.technology.value); if (selectedCombobox=="-1") { alert("Please Select Technology"); return false; } return true; } </script> </HEAD> <BODY> <form name="comboForm"> <select name="technology"> <option value="-1">Select</option> <option value="JSP">Java Server Pages</option> <option value="Servlet">Servlet</option> <option value="PHP">PHP</option> <option value="ASP">ASP</option> </select> <input type="submit" value="submit" onclick="return validateR();"> </form> </BODY> </HTML>
  2. I wasn't aware that you would have needed to totally rerite my code sorry about that Making those changes didn't make it change to mmddyyyy format
  3. Thankyou very much for that. on another not if I have a client that wants the format as mmddyyyy what would I need to alter in your new version to accomodate that again if needed. thanks in advance
  4. I have a script that shows how many days between given dates but you have to enter the date in mm/dd/yyy format. I would like to change it so I can enter it in dd/mm/yyy format. Here is the script below. Any help would be greatly appreciated, thanks Head code <title>Datediff</title> <script type='text/javascript'> var msPerSec = 1000 // # milliseconds / Second var secPerMin = 60 // # Seconds / Minute var secPerHr = 60 * secPerMin // # Seconds / Hour var secPerDay = 24 * secPerHr // # Seconds / Day var secPerYr = 365.25 * secPerDay // # Seconds / Year function field( id ) { var ele = document.getElementById( id ) if ( !ele ) { alert( 'Element not found. id="' + id + '"' ) } return ele } function setVal( id, val ) { var ele = field( id ) if ( ele ) { ele.innerHTML = val } } function getVal( id ) { var ele = field( id ) var result = null if ( ele ) { result = ele.value } return result } function CalculateDiff( d1, d2 ) { var date1 = new Date( getVal( d1 ) ) var date2 = new Date( getVal( d2 ) ) var diff = Math.floor( Math.abs( date2 - date1 ) / msPerSec ) var years = Math.floor( diff / secPerYr ) var rest = diff - years * secPerYr var days = Math.floor( rest / secPerDay ) setVal( 'days' , days ) rest = rest - days * secPerDay var hours = Math.floor( rest / secPerHr ) rest = rest - hours * secPerHr var mins = Math.floor( rest / secPerMin ) rest = rest - mins * secPerMin } </script> Body COde <form name='' action=''> <br>Date 1 <input type='text' value='11/01/2006' id='date1'/> <br>Date 2 <input type='text' value='12/29/2007' id='date2'/> <br> <input type='button' value='Calculate difference' onclick='CalculateDiff("date1","date2");'> <br> Calculated Difference <table border='1'> <tr> <th>Days </th><td><textarea name='days' rows='1' cols='8' id='days'> </textarea></td> </tr> </table> </form>
  5. Hi ll, I have a php mail script I wrote and it works quite well except one little part On my web page I have a form field called email and in my php script I want to use the data from that field to be place in the cc and reply-to field. The cc part works but not the reply-to. Can someone please take a look at my code and see where it is wrong if possible. Thanks in advance <? //change this to your email. $to = "myemail@mail.com"; $from = "Website Support"; $subject = "Website Support Enquiry"; $headers = "From: $from\r\n"; $headers .= "Content-type: text/html\r\n"; /*options to send to cc+bcc+reply-to you can use either a hidden field in antenna and use the variable to suit eg $headers .= "Cc: $cc\r\n"; or you can use the fields in this manner eg $headers .= "Cc: youremail@domain.com\r\n"; */ $headers .= "Cc: $email\r\n"; //$headers .= "Bcc: youremail@domain.com\r\n"; $headers .= "Reply-To: $email"; //begin of HTML message $message = <<<EOF <table style='background-color: white; font-size:12px' cellpadding='3' cellspacing='3'> <tr> <td><b>Name</b></td> <td>$name</td> </tr> <tr> <td><b>Subject</b></td> <td>$subject <b>Email:</b> $email <b>Phone:</b> $phone </td> </tr> <tr> <td><b>Address</b></td> <td>$address</td> </tr> <tr> <td><b>Type</b></td> <td>$type</td> </tr> <tr> <td><b>Message</b></td> <td>$message</td> </tr> </table> EOF; //end of message // now lets send the email. // mail($to, $subject, $message, $headers); if ( mail($to,$subject,$message,$headers) ) { //header("Location: cart.htm"); echo "<br><br>Your mail has been sent"; } else { // header("Location: http://www.yourerrorpage.com"); echo "The email has failed! Please press the back button on your browser and try again"; } ?>
  6. I have a php mail script that allows attachements and you can also set the layout in the $message section for a html email template and it works fine if you have an attachement and when the mail arives it is laid out like the template however if you don't have an attachement all you get is a basic message and the rest of the data won't arrive. Could someone take a look at the attached file and advise what is wrong if possible Thanks heaps in advance [attachment deleted by admin]
  7. I have this php code that enables you to add a bcc field into it and it all seems to work great however if you comment out the $to part fot the address it still goes to the redirect page and says it was sent successful. Can someone take a look and tell me where I have gone wrong in my code please Thanks in advance [attachment deleted by admin]
  8. I have this script that when you place anything in div tags and give the correct ID it will print only that data. I ususlly works fine but since upgrading Firefox to 3.6.3 it only prints a blank page instead of the data on it. Instructions to use: place a div on your page and give it an id="printMe then add some content between the div and then finally add the head and body code and try and print it. Sometimes on Firefox it works for me and others it fails, It works fine in IE. Thanks in advance if anyone can sofrt it out for me. here is the script ------Head code below---- <script language="JavaScript"> var gAutoPrint = true; // Tells whether to automatically call the print function function printMe() { if (document.getElementById != null) { var html = '<HTML>\n<HEAD>\n'; if (document.getElementsByTagName != null) { var headTags = document.getElementsByTagName("head"); if (headTags.length > 0) html += headTags[0].innerHTML; } html += '\n</HE>\n<BODY>\n'; var printareaElem = document.getElementById("printarea"); if (printareaElem != null) { html += printareaElem.innerHTML; } else { alert("OOPS! could not find the printarea function"); return; } html += '\n</BO>\n</HT>'; var printWin = window.open("","printMe"); printWin.document.open(); printWin.document.write(html); printWin.document.close(); if (gAutoPrint) printWin.print(); } else { alert("The print ready feature is only available in modern browsers. Please update your browswer."); } } </script> ---body code for button below <form id="printMe" name="printMe"> <input type="image" name="print" onClick="printMe()" src="images/printme.jpg"> </form>
  9. I have this javascript that when you press a button it oauto selects the data in the textarea and copies it so all you need to do is paste it back into another application. It works fine in IE but in other browsers it only highlights but not copies it to the clipboard, can someone take a look and advise where I have gone wrong please. here is the code <HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function copyit(theField) { var tempval=eval("document."+theField) tempval.focus() tempval.select() therange=tempval.createTextRange() therange.execCommand("Copy") } // End --> </script> </head> <BODY> <form name="it"> <div align="center"> <input onclick="copyit('it.select1')" type="button" value="Press to Copy the Text" name="cpy"> <p> <textarea name="select1" rows="3" cols="25"> If this is highlighted, then it has been copied. </textarea> </div> </form> <!-- Script Size: 1.21 KB --> </body>
  10. I have a javascript that copies from an input field straight to the page. Currently it only works on text boxes but I was wondering if anyone can get it to work with a radio box and check box. Just input data in the first field then click on the page and you will see it work. Here is the script This is the contents of a external file called copydata.js function copyData(el) { document.getElementById('copy_' + el.id).innerHTML = el.value; } This goes in the head section <script type="text/javascript" src="copydata.js"></script> and this is the body section it has 2 parts on is the input and the other is where it places the data Part 1 Name: <input type="text" name="name" style="width:250px; font-family: Verdana; font-size: 11px" id="name" onchange="copyData(this);"> Part 2 <b>Name: </b> <br> <TEXTAREA name="name" COLS=30 ROWS=1 id="copy_name" style="border: none; border-color: black; background-color: white; overflow: auto; font-family: Verdana; font-size: 11px" readonly="readonly"></TEXTAREA> Thanks in advance
  11. Hi. I have a conformation script that works well and when it pops up you have the option of ok or cancel. If you click on ok it will submit a form and I want it to return to a different page on my site if the user clicks cancel This is part of my code, It is only the head part I have the issue with the rest of the body is not important it is what the box pops up and the user clicks I can't get working In the head I have this <script type="text/javascript"> <!-- function confirmation() { var answer = confirm("Click ok to accept terms and submit form\r\nOtherwise click Cancel to return back to website") if (answer){ window.location = "terms2.htm"; } else{ window.location = "index.htm"; } } //--> </script> and in the body I have this <input type="button" onclick="confirmation()" value="submit"> thanks in advance for any help
  12. Thankyou mjdamato, all sorted and I thankyou for your time it was much appreciated. Graham
  13. The check all doesn't work if you click it all it does is put a check int he boxes and then if you click again it removes it. The text area is not being populated with it is checked or unchecked
  14. Oh just one other question if you don't mind how can I add a check all box to it. Thanks
  15. Thankyou very much for your quick response and the fix for my issue. Much appreciated
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.