Jump to content

Search the Community

Showing results for tags 'js'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 98 results

  1. Is it possible to print an image (send it to a users printer) that is not on the current page? I have an application which uploads an image to a server, then a js function which currently opens the image alone in a new window, where I am then printing the image from. However instead of this, I would prefer the user stay on their current page, and have the print dialogue pop up there, rather than sending them to a new window with just an image. Any help or advice is much appreciated.
  2. help me if you have any idea i am new in development field, pls any one....
  3. Hi every one!!! after a very long time I'm log in to this forum. let's come to the topic, the problem which I'll be experiences is that i'll create the html 5 audio. write my own script to control the playback, works fine! Now I want to know that how we can use the javascript to determined how much data is loaded on the user computer. means that if a file is 20 or 40 MB in size I want to show the progress to the user how much data is loaded on your computer. and up to what time audio can be played smoothly. just like the youtube white progress tells us. any possibility in JS? Help is appreciated.
  4. Hi, I need to use getElementById to reference to a div which contains a pic and without changing anything in the body tag, a random image slideshow should appear on load! instead of that pic. I have tried different ways to sort it out, but it was never perfect... Got 3 problems, first function changeDiv it says getElementsByTagname(...)[] is not defined... second is in the function rotateimage else document.images.splash undefined... third newimages function overwrites the whole page and it should only change the div anyone could help me out on this one?? Thanks 1.html
  5. Hi please help wiith php code, im trying to retrieve data from a self referencing table types(id,name,parent,desc) this values should be in a drop down list "<li>" in html Thanks in advanced
  6. Hello everyone, I am trying to create a simple slideshow to learn javascript and a small amount of PHP. People are meant to simply upload a photo to their site using for example Filezilla. The website should automaticly take the photo into the slideshow. I am still very novice though. So far I got: + PHP to read the file names in the folder. + Javascript to take over the PHP Array. That is not much.. but I already run into a mistake in the next part. <?php $PhotoSlideAll = scandir('./photos'); $PhotoSlide = array_diff($PhotoSlideAll, array('.', '..'));?> <script> var SlideShow = ["<?php echo join("", "", $PhotoSlide); ?>"]; var SSl=SlideShow.length - 1; var picture = "'../photos/" + SlideShow[0] + "'" document.getElementById("backgroundswitch").style.backgroundImage = "url(picture)";</script> Now somehow, it doesn't actually change the background. Whilst the variable picture is really '../photos/PHOTONAME.jpg' when I use an Alert to test it. Edit: Thank you in advance
  7. First of all, i am particularly focusing on the cross-reference across files feature. What is it? Simply say, it is like writing Java in Eclipse or Netbeans: When we "dot" a class, a pull down list of member variables show up. When we "ctrl + click" on a usage (of a variable, of a class, of a method, etc), it jumps to the definition of it. I particularly see this feature very helpful, especially when our project goes huge. If we don't need the benefits from this feature, why not use the free and quick editor - Notepad++ ? Many PHP dev tools are equipped with the reference feature. But not many of them can do it across different files. (means in case the definition occurs in a different file of usage.) While I was finding such a (free) IDE which can do this, I heard people keep saying the Eclipse PDT cannot reference across files. Until today, I give it a try. And surprisingly, Eclipse can do it! With the following code snippets: Car.php <?phpclass Car { public function get_type() { return $this->type; // reference OK } public $type = 'ferrari';}class Engine { public function running_in() { // in same file $car = new Car(); // of course this can ref Car echo $car->get_type(); // of course this ok too return $car->type; // of course this ok as well }}?> Driver.php <?php//include 'Car.php'; // works even without include$car = new Car(); // reference OKecho $car->get_type(); // reference OKecho $car->type; // reference OK?> Although this is a good news. Yet I still want to know why people says Eclipse PDT cannot reference across files? Is there any misunderstandings, that I am implementing it wrongly? Also, as many people say, Eclipse is slow because it is Java based. I am ok with the speed. But I still want a comparison list of features of different Web Dev IDE. Thanks for any input about Web Dev Tool discussion! P.S. In addition, JavaScipt list of methods with browser supporting versions (like what Aptana has) would be a very nice feature too!
  8. forms.js.txtform.txtMailHandler.php.txt I am a photographer with a strong design and coding background trying to make myself a new website.I'm trying to tweak a template to suit my needs, and I am having considerable trouble with the Contact Form page. I am very familiar with html and css, but js is not my strong suit and I have never worked with php before. If anyone could help me by letting me know where/what I need to edit for the submit button to make the form information go to my email I would greatly appreciate it. I have tried editing what I thought was right, and it still doesn't work. I have given up on my edited files and reverted back to the original template files because I'm sure the files I have been editing are beyond repair at this point. I really need to get this site up and running ASAP, but I am at my wits end with this form. Everything else on the form seems to work fine. These are my thoughts: [*] [*]The action element of the form tag is set to "#". That's not right, but I'm not sure what to put there. And there is no method element.[*] [*]The owner-email on the .js page is also set to #, so I'm sure I need to put in the email address there. I'm just not sure about the syntax.[*] [*]There is also a spot in the .php file that I feel needs to have my email address also, but again, I'm unsure of the syntax. [*] [*]Also the a tag href element on the submit button is also set to "#" and I'm not sure where to point it, because it appears that the form should give the user a .js message confirming that the form has been sent...[*] This is the form code in the html file: <h2>Contact form</h2><form action="#" id="ContactForm"><div class="success"> Contact form submitted!<br><strong>We will be in touch soon.</strong> </div><fieldset><div class="wrapper"><span class="col1">Name:</span><label class="name"> <span class="bg"><input type="text" class="input"></span><span class="error">*This is not a valid name.</span> <span class="empty">*This field is required.</span> </label></div><div class="wrapper"><span class="col1">Email:</span><label class="email"><span class="bg"><input type="text" class="input"></span><span class="error">*This is not a valid email address.</span> <span class="empty">*This field is required.</span> </label></div><div class="wrapper"><span class="col1">Message:</span><label class="message"><span class="bg"><textarea rows="1" cols="1"></textarea></span><span class="error">*The message is too short.</span> <span class="empty">*This field is required.</span> </label> </div><div class="btns"><a href="#" class="button1" data-type="submit">Send</a><a href="#" class="button1" data-type="reset">Clear</a></div></fieldset></form> This is the forms.js file: //forms;(function($){$.fn.forms=function(o){return this.each(function(){var th=$(this),_=th.data('forms')||{errorCl:'error',emptyCl:'empty',invalidCl:'invalid',notRequiredCl:'notRequired',successCl:'success',successShow:'4000',mailHandlerURL:'bin/MailHandler.php',ownerEmail:'support@guardlex.com',stripHTML:true,smtpMailServer:'localhost',targets:'input,textarea',controls:'a[data-type=reset],a[data-type=submit]',validate:true,rx:{".name":{rx:/^[a-zA-Z'][a-zA-Z-' ]+[a-zA-Z']?$/,target:'input'},".state":{rx:/^[a-zA-Z'][a-zA-Z-' ]+[a-zA-Z']?$/,target:'input'},".email":{rx:/^(("[w-s]+")|([w-]+(?:.[w-]+)*)|("[w-s]+")([w-]+(?:.[w-]+)*))(@((?:[w-]+.)*w[w-]{0,66}).([a-z]{2,6}(?:.[a-z]{2})?)$)|(@[?((25[0-5].|2[0-4][0-9].|1[0-9]{2}.|[0-9]{1,2}.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2}).){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})]?$)/i,target:'input'},".phone":{rx:/^+?(d[d-+() ]{5,}d$)/,target:'input'},".fax":{rx:/^+?(d[d-+() ]{5,}d$)/,target:'input'},".message":{rx:/.{20}/,target:'textarea'}},preFu:function(){_.labels.each(function(){var label=$(this),inp=$(_.targets,this),defVal=inp.val(),trueVal=(function(){var tmp=inp.is('input')?(tmp=label.html().match(/value=['"](.+?)['"].+/),!!tmp&&!!tmp[1]&&tmp[1]):inp.html()return defVal==''?defVal:tmp})()trueVal!=defVal&&inp.val(defVal=trueVal||defVal)label.data({defVal:defVal}) inp.bind('focus',function(){inp.val()==defVal&&(inp.val(''),_.hideEmptyFu(label),label.removeClass(_.invalidCl))}).bind('blur',function(){_.validateFu(label)if(_.isEmpty(label))inp.val(defVal),_.hideErrorFu(label.removeClass(_.invalidCl)) }).bind('keyup',function(){label.hasClass(_.invalidCl)&&_.validateFu(label)})label.find('.'+_.errorCl+',.'+_.emptyCl).css({display:'block'}).hide()})_.success=$('.'+_.successCl,_.form).hide()},isRequired:function(el){ return !el.hasClass(_.notRequiredCl)},isValid:function(el){ var ret=true$.each(_.rx,function(k,d){if(el.is(k))ret=d.rx.test(el.find(d.target).val()) })return ret },isEmpty:function(el){var tmpreturn (tmp=el.find(_.targets).val())==''||tmp==el.data('defVal')},validateFu:function(el){ el.each(function(){var th=$(this),req=_.isRequired(th),empty=_.isEmpty(th),valid=_.isValid(th) if(empty&&req)_.showEmptyFu(th.addClass(_.invalidCl))else_.hideEmptyFu(th.removeClass(_.invalidCl)) if(!empty)if(valid)_.hideErrorFu(th.removeClass(_.invalidCl))else_.showErrorFu(th.addClass(_.invalidCl)) })},getValFromLabel:function(label){var val=$('input,textarea',label).val(),defVal=label.data('defVal') return label.length?val==defVal?'nope':val:'nope'},submitFu:function(){_.validateFu(_.labels) if(!_.form.has('.'+_.invalidCl).length)$.ajax({type: "POST",url:_.mailHandlerURL,data:{name:_.getValFromLabel($('.name',_.form)),email:_.getValFromLabel($('.email',_.form)),phone:_.getValFromLabel($('.phone',_.form)),fax:_.getValFromLabel($('.fax',_.form)),state:_.getValFromLabel($('.state',_.form)),message:_.getValFromLabel($('.message',_.form)),owner_email:_.ownerEmail,stripHTML:_.stripHTML},success: function(){_.showFu()}}) },showFu:function(){_.success.slideDown(function(){setTimeout(function(){_.success.slideUp()_.form.trigger('reset')},_.successShow)})},controlsFu:function(){$(_.controls,_.form).each(function(){var th=$(this)th.bind('click',function(){_.form.trigger(th.data('type'))return false})})},showErrorFu:function(label){label.find('.'+_.errorCl).slideDown()},hideErrorFu:function(label){label.find('.'+_.errorCl).slideUp()},showEmptyFu:function(label){label.find('.'+_.emptyCl).slideDown()_.hideErrorFu(label)},hideEmptyFu:function(label){label.find('.'+_.emptyCl).slideUp()},init:function(){_.form=_.me _.labels=$('label',_.form) _.preFu() _.controlsFu() _.form.bind('submit',function(){if(_.validate)_.submitFu()else_.form[0].submit()return false}).bind('reset',function(){_.labels.removeClass(_.invalidCl) _.labels.each(function(){var th=$(this)_.hideErrorFu(th)_.hideEmptyFu(th)})})_.form.trigger('reset')}}_.me||_.init(_.me=th.data({forms:_}))typeof o=='object'&&$.extend(_,o)})}})(jQuery)$(window).load(function() { $('#ContactForm').forms({ownerEmail:'#'})}) And this is the mailhandler.php file: <?php$owner_email = $_POST["owner_email"];$headers = 'From:' . $_POST["email"];$subject = 'A message from your site visitor ' . $_POST["name"];$messageBody = ""; if($_POST['name']!='nope'){$messageBody .= '<p>Visitor: ' . $_POST["name"] . '</p>' . "n";$messageBody .= '<br>' . "n";}if($_POST['email']!='nope'){$messageBody .= '<p>Email Address: ' . $_POST['email'] . '</p>' . "n";$messageBody .= '<br>' . "n";}else{$headers = '';}if($_POST['state']!='nope'){ $messageBody .= '<p>State: ' . $_POST['state'] . '</p>' . "n";$messageBody .= '<br>' . "n";}if($_POST['phone']!='nope'){ $messageBody .= '<p>Phone Number: ' . $_POST['phone'] . '</p>' . "n";$messageBody .= '<br>' . "n";} if($_POST['fax']!='nope'){ $messageBody .= '<p>Fax Number: ' . $_POST['fax'] . '</p>' . "n";$messageBody .= '<br>' . "n";}if($_POST['message']!='nope'){$messageBody .= '<p>Message: ' . $_POST['message'] . '</p>' . "n";} if($_POST["stripHTML"] == 'true'){$messageBody = strip_tags($messageBody);} try{if(!mail($owner_email, $subject, $messageBody, $headers)){throw new Exception('mail failed');}else{echo 'mail sent';}}catch(Exception $e){echo $e->getMessage() ."n";}?> Any help would be greatly appreciated!
  9. I have run the gradient creation code on its own as the page loads, but now I want to use it in a button click event, so I have tried to enclose it as a function that the button onclick event calls. I get no response at all so I assume I need to pass something in as a parameter, but I cant see what. or does it need an event listener somewhere? index.html testprojectcss.css
  10. Ok i'm totaly new here, I play with some code when I have time for it... But I'm a little confused, it seems that the new ajax way is coded as $.ajax but that I don't understand yet, Because i'm adjusting some existing code I have to go from one php file to another over js the old way... So I have a php file where I echo a div with an input as type="text" and id="txtnameposition", in the same div I have a button who is calling the function closeandmail in the JS file. In the JS file I get de input of the textbox as: var jsName = document.getElementById("txtnameposition").value; When I put an alert(jsName); inside the JS file I do get the input value, so passing values from the first php file to the js file is no problem.... BUT, to send this all to the next PHP file I used next code in the JS file: function getHTTPObject(){var xhr = false;//set to false, so if it fails, do nothingif(window.XMLHttpRequest) {//detect to see if browser allows this methodvar xhr = new XMLHttpRequest();//set var the new request} else if(window.ActiveXObject) {//detect to see if browser allows this methodtry {var xhr = new ActiveXObject("Msxml2.XMLHTTP");//try this method first} catch(e) {//if it fails move onto the nexttry {var xhr = new ActiveXObject("Microsoft.XMLHTTP");//try this method next} catch(e) {//if that also fails return false.xhr = false;}}}return xhr;//return the value of xhr}function closeandmail(){var jsName = document.getElementById("txtnameposition").value;httpObjectMail = getHTTPObject();if (httpObjectMail !== null) {httpObjectMail.open("GET", "mail.php?"+ "Name=" + jsName);httpObjectMail.send(null);}httpObjectMail = null;} And in the second PHP file I put next code: $Name = $_GET['Name']; echo 'Name = '.$Name;$MailMessage = 'The name = '.$Name;$to = 'mail@mail.com';$subject = 'The name = '.$Name;$headers = 'From: mail@mail.com'.'rn'.'X-Mailer: PHP/' . phpversion();mail($to, $subject, $MailMessage, $headers); The echo only shows "Name = " and no value, so can someone please tell me what is wrong in this code? because I did try a lot of things but it didn't work so far. Greetings Trace7r.
  11. Hi,I am not an IT guy (I am a paleontologist =) and my mother-tongue is not English. I have built few small websites: for instance, one for an open access scientific journal, that I am keeping on maintaining and upgrading. For some of them I have had the possibility to use PHP and MySQL (I manage to write .inc and .php files, but obviously it is not me but my IT colleagues at the University who take care of the server issues!). For other sites I can only use HTML (no PHP, no PERL, no ASP, ...). Therefore sometimes I have to manipulate a little javascript and when I combine pieces of code I get something that works and which is quite useful.Of course sometimes it isfrustrating to be unable to use a server-based database but it forces me to look for solutions elsewhere ... and actually it is fine to have tools and data which are not server-based, that is you can run from your PC (or Mac) or from a CD/DVD. The scientific journal I am publishing get a yearly DVD version and we use a very efficient JS search engine to explore it ("Tipue"). Recently I have build an XML (-like) file with some 7,500 entries. I used some pieces of scripts given in examples of the W3Schools and combine them in order to parse this flat database :1) to display some data corresponding to a certain id/an ordering number out of the 7,500 (display1: name, year, title), then by clicking on it getting a larger set of data for the same id (display2: name, year, title, reference, abstract, keywords);2) to browse up and down the entries, one after the other, with an increment of one, five or twenty, or to be able to go to a certain id by entering its id number in a form.This database will be used to document an open access web publication about FOSSIL corals and sponges (you can see that my fields of interests are quite far from programming!). This script I "built" WORKS on my PC with Firefox,http://paleopolis.re...rowse_test.htmlbut not with Chrome (nor Safari). Chrome gives me 4 errors but I am unable to understand them (it is Chinese to me). The file FCnP.xml is at the same level as the browse_test.html ...It also works on my spouse's Ipad! Is there anybody to help me? Here is the HTML code : <!DOCTYPE html><html><head><script language="javascript1.3">if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }xmlhttp.open("GET","FCnP.xml",false);xmlhttp.send();xmlDoc=xmlhttp.responseXML;x=xmlDoc.getElementsByTagName("RECORD");i=0;function displayCD(){id=(x[i].getElementsByTagName("ID")[0].childNodes[0].nodeValue);artist=(x[i].getElementsByTagName("AUTHORS")[0].childNodes[0].nodeValue);year=(x[i].getElementsByTagName("YEAR")[0].childNodes[0].nodeValue);title=(x[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue);txt= id + " - Author(s): " + artist + "<br>Year: "+ year + "<br>Title: " + title;document.getElementById("showCD").innerHTML=txt;}function displayCDInfo(){artist=(x[i].getElementsByTagName("AUTHORS")[0].childNodes[0].nodeValue);year=(x[i].getElementsByTagName("YEAR")[0].childNodes[0].nodeValue);title=(x[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue);source=(x[i].getElementsByTagName("SOURCE")[0].childNodes[0].nodeValue);abstr=(x[i].getElementsByTagName("ABSTRACT")[0].childNodes[0].nodeValue);fcnp=(x[i].getElementsByTagName("FCnP")[0].childNodes[0].nodeValue);subject=(x[i].getElementsByTagName("SUBJECT")[0].childNodes[0].nodeValue);syst=(x[i].getElementsByTagName("SYST")[0].childNodes[0].nodeValue);strat=(x[i].getElementsByTagName("STRAT")[0].childNodes[0].nodeValue);geog=(x[i].getElementsByTagName("GEOG")[0].childNodes[0].nodeValue);txt= artist + " (<b>" + year + "</b>).- " + title + "- " + source + " - <b>FC&P:</b> " + fcnp + "<br><b>Abstract:</b> " + abstr + "<br>Topic(s): " + subject + "<br>Systematics: " + syst + "<br>Stratigraphy: " + strat + "<br>Geography: " + geog;document.getElementById("showCD").innerHTML=txt;}function next(){if (i<x.length-1) { i++; displayCD(); }}function previous(){if (i>0) { i--; displayCD(); }}function next5(){if (i<x.length-1) { i+=5; displayCD(); }}function previous5(){if (i>5) { i-=5; displayCD(); }}function next20(){if (i<x.length-1) { i+=20; displayCD(); }}function previous20(){if (i>20) { i-=20; displayCD(); }}function goForit(){if (i<6708) { i=+this.document.testform.inputbox.value; displayCD(); }}</script></head><body onload="displayCD()"><script language="javascript1.3">document.write("<p>");if (i==0) { document.write("<div id='showCD' onclick='displayCDInfo(" + i + ")'></div>"); }elsefor (i=1;i<x.length;i++) { document.write("<div id='showCD(" + i + ")' onclick='displayCDInfo(" + i + ")'></div>"); }document.write("</p>");</script><form name="testform"><input type="button" onclick="previous20()" value="-20" /><input type="button" onclick="previous5()" value="-5" /><input type="button" onclick="previous()" value="-1" /><input type="text" name="inputbox" value="" size="5"><input type="button" name="Enter" Value="Enter" onClick="goForit(this.form)"><input type="button" name="Reload" value="Reload" onClick="window.location.reload()"><input type="button" onclick="next()" value="+1" /><input type="button" onclick="next5()" value="+5" /><input type="button" onclick="next20()" value="+20" /></form></body></html> It would be great (and acknowledged), if someone could provide us with solutions to these problems OR an alternative way to get the same (actually better) results.I believe that this simple assemblage of function could be very usefull for many colleagues of mine (paleontologists, ...). I thank you in advance for your time and consideration.=) BG
  12. Hello people, I'm a new member here and this is my first post. I have a form with 3 fields (UserID, UserFirstname, UserSurname). I want a jquery validation script that would check if the UserID entered is in the database. If TRUE it should echo "Valid UserID" and If FALSE it should echo "Invalid UserID" I have the following codes but it seems not to be executing the PHP File. ///Sign Up Form<div id="form"><form method="post" action="validate.php" id="formID"> <table width="351" height="155" border="0"> <tr> <td width="103">Sign Up Level<span class="styledmenu"></span></td> <td width="238"><label for="textfield"></label> <label for="level"></label> <select name="level" id="level"> <option value="Enrollee">Enrollee</option> <option value="Provider">Provider</option> </select></td> </tr> <tr> <td>CIL Number ?</td> <td><input type="text" class="validate[required,custom[onlyLetterNumber],maxSize[20],ajax[ajaxUserCallPhp]] text-input" name="cil" id="cil" /></td> </tr> <tr> <td>Surname:</td> <td><input type="text" class="validate[required,custom[onlyLetterSp],maxSize[20],ajax[ajaxNameCallPhp]] text-input" name="sname" id="sname" /></td> </tr> <tr> <td>Fullname:</td> <td><input type="text" class="validate[required,custom[onlyLetterSp],maxSize[20],ajax[ajaxNameCallPhp]] text-input" name="fname" id="fname" /></td> </tr> <tr> <td> </td> <td><input type="submit" name="signup" id="signup" value="Sign Up" /></td> </tr> </table> </form> </div> ///Validate.php <?phprequire_once('../Connections/connection.php');//include('popupform.php');//create our own array like this$field = $_GET['fieldId'];$value = $_GET['fieldValue']; //this will contain the value in the textbox$data[$field] = $value; if(isset($_POST['cil'])){ $val = mysql_real_escape_string($_POST['cil']);//validate if value is in the database$check_sql = "SELECT * FROM enrollees WHERE cid='$val'";$check_query = mysql_query($check_sql);$row_check = mysql_fetch_assoc($check_sql);$check_num = mysql_num_rows($check_query); if($check_num == 1){$rtn = true;}else{$rtn = false;}}//convert to json//header('Content-Type: text/json');echo json_encode($rtn);?> ///JQUERY (function($){ $.fn.validationEngineLanguage = function(){ }; $.validationEngineLanguage = { newLang: function(){ $.validationEngineLanguage.allRules = { "required": { // Add your regex rules here, you can take telephone as an example "regex": "none", "alertText": "* This field is required", "alertTextCheckboxMultiple": "* Please select an option", "alertTextCheckboxe": "* This checkbox is required" }, "minSize": { "regex": "none", "alertText": "* Minimum ", "alertText2": " characters allowed" }, "maxSize": { "regex": "none", "alertText": "* Maximum ", "alertText2": " characters allowed" }, "min": { "regex": "none", "alertText": "* Minimum value is " }, "max": { "regex": "none", "alertText": "* Maximum value is " }, "past": { "regex": "none", "alertText": "* Date prior to " }, "future": { "regex": "none", "alertText": "* Date past " }, "maxCheckbox": { "regex": "none", "alertText": "* Checks allowed Exceeded" }, "minCheckbox": { "regex": "none", "alertText": "* Please select ", "alertText2": " options" }, "equals": { "regex": "none", "alertText": "* Fields do not match" }, "phone": { // credit: jquery.h5validate.js / orefalo "regex": /^([\+][0-9]{1,3}[ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/, "alertText": "* Invalid phone number" }, "email": { // Simplified, was not working in the Iphone browser "regex": /^([A-Za-z0-9_\-\.\'])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,6})$/, "alertText": "* Invalid email address" }, "integer": { "regex": /^[\-\+]?\d+$/, "alertText": "* Not a valid integer" }, "number": { // Number, including positive, negative, and floating decimal. credit: orefalo "regex": /^[\-\+]?(([0-9]+)([\.,]([0-9]+))?|([\.,]([0-9]+))?)$/, "alertText": "* Invalid floating decimal number" }, "date": { "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/, "alertText": "* Invalid date, must be in YYYY-MM-DD format" }, "ipv4": { "regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/, "alertText": "* Invalid IP address" }, "url": { "regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/, "alertText": "* Invalid URL" }, "onlyNumberSp": { "regex": /^[0-9\ ]+$/, "alertText": "* Numbers only" }, "onlyLetterSp": { "regex": /^[a-zA-Z\ \']+$/, "alertText": "* Letters only" }, "onlyLetterNumber": { "regex": /^[0-9a-zA-Z\ \/]+$/, "alertText": "* No special characters allowed" }, // --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings "ajaxUserCall": { "url": "signup.php", // you may want to pass extra data on the ajax call "alertTextOk": "* Correct CIL", "alertText": "* This user is already taken", "alertTextLoad": "* Validating CIL, please wait" }, "ajaxUserCallPhp": { "url": "signup.php", // you may want to pass extra data on the ajax call // if you provide an "alertTextOk", it will show as a green prompt when the field validates "alertTextOk": "* Correct CIL", "alertText": "* Invalid CIL", "alertTextLoad": "* Validating CIL, please wait" }, "ajaxNameCall": { // remote json service location "url": "ajaxValidateFieldName", // error "alertText": "* This name is already taken", // if you provide an "alertTextOk", it will show as a green prompt when the field validates "alertTextOk": "* This name is available", // speaks by itself "alertTextLoad": "* Validating, please wait" }, "ajaxNameCallPhp": { // remote json service location "url": "signup.php", // error "alertText": "* This name is already taken", // speaks by itself "alertTextLoad": "* Validating Name, please wait" }, "validate2fields": { "alertText": "* Please input HELLO" } }; } }; $.validationEngineLanguage.newLang();})(jQuery); Anyone There spotting the problem please let me know.
  13. Hi! I am making a little game for iOS using apache's Cordova.I use Zepto.js as a light css3 jQuery replacement for animations etc. Players have to create letters as Wim Crouwel did in his New Alphabet, they have to do it in a short amount of time, thus far the project is going fine for the limited skills i have but now i am encountering a problem and i dont know where it could come from. What happens is that when i validate if a letter hase been constructed correctly and it is in fact correct it adds 2 "levels" instead of just 1, what i discovered is that the script actually runs twice. It even reacts tot the amounts of clicks i made on the page, lets say i click 4 "clickable" element's on the page it ads 4 levels. This is what i get in the console: 2 clicks = 2 levels up?validating...correct! go from level 0 to..1validating...correct! go from level 0 to..2 here is a live demo:http://bram-de-leeuw...welGame/(you'll probably have to resize your browser to make it work, the first thing you'll see is a iPhone5 version that isn't styled correctly. When you'll make your browser smaller it will show a iPhone 4 version.) This is the validation code: // Validate Letter A$("#verder").click(function () {//if (Level = 0){ // LETTER = A // CORRECT console.log("validating..."); if ( // LETTER A $(".CenterBottom").hasClass("black") === true && $(".CenterRight").hasClass("black") === true && // NOT LETTER A $(".CenterLeft").hasClass("black") === false && $(".CenterTop").hasClass("black") === false && // ETC.. ){ // IF ITS CORRECT console.log("correct! go from level 0 to..") Level++; $("#alert-fact").animate("Alert", {duration:2000, easing: 'ease'}); $(".CenterBottom").animate("Correct", {duration:2000, easing: 'ease'}); $(".CenterRight").animate("Correct", {duration:2000, easing: 'ease'}); console.log(Level); // SOMETHING IS MISSING } else if ( $(".CenterBottom").hasClass("black") === true && $(".CenterRight").hasClass("black") === false || $(".CenterRight").hasClass("black") === true && $(".CenterBottom").hasClass("black") === false ) { $("#alert-missing").animate("Alert", {duration:2000, easing: 'ease'}); if ($(".CenterBottom").hasClass("black") === true) { $(".CenterBottom").animate("Correct", {duration:2000, easing: 'ease'}); }; if ($(".CenterRight").hasClass("black") === true) { $(".CenterRight").animate("Correct", {duration:2000, easing: 'ease'}); }; // WRONG } else { $("#alert-wrong").animate("Alert", {duration:2000, easing: 'ease'}); };//};//if (Level = 1){ // LETTER = B//};});
  14. Hi, i need help for this error, I keep getting this error -->> "Unable to get value of the property 'innerHTML': object is null or undefined" when am running the program in IE & nothing is running in other web browsers... Below is the javascript (JScript.js) code: var output = document.getElementById('output'), pressed = {}; window.onkeydown = function (e) { if (pressed[e.which]) return; pressed[e.which] = e.timeStamp;}; window.onkeyup = function (e) { if (!pressed[e.which]) return; var duration = (e.timeStamp - pressed[e.which]) / 1000; output.innerHTML += '<p>Key ' + e.which + ' was pressed for ' + duration + ' seconds</p>'; pressed[e.which] = 0;}; Here is my asp code (test.aspx): <html><head><title>XXX</title></head><body> <h1>Keystroke Dynamics</h1> <p>Try pressing some keys on your keyboard ...</p> <script type="text/javascript" src="JScript.js"></script> <div id="output"></div></body></html> May I know the problem that cause this error & how can I correct it?? I tried the same program in php and it works but not in asp.net 2010...Thank you...
  15. http://jsbin.com/azipok/2/edit this piece of code does the trick of clearing up the option list of select menu and adding a "test" message, but this message becomes visible only upon dropping down the select menu. is there a way to make this "test" message display and replace the "no modules..." text upon clicking the button?
  16. OK, I have hit a snag and I want to try and make this work if I can. I am trying to add a new text field next to a current list field based on a single selected item. can anyone help me on this? I added the segments that I want this to change. *script* function DbRole(myform){if (document.myform.Accesslevel1.value=="Database Role = "){document.myform.Accesslevel1("DbRole1").setValue(""); AddFields();}} *form* <input name="Accessgroups1" type="text" size="50"> <select name="Accesslevel1"> <option value=""></option> <option value="Read">Read</option> <option value="Write">Write</option> <option value="Read/Write">Read/Write</option> <option value="Update">Update (accounting)</option> <option value="Delete">Delete (Accounting)</option> <option value="Update/Delete (Accounting)">Update/Delete (Accounting)</option> <option onChange="DbRole()" value="Database Role = ">-Database Role-</option> (**the idea is that when this last item is selected a text field will appear next to this list field**) </select> Any help would be appreciated, I am new to this but I have already managed to set up other js that works but this one escapes me at this moment.
  17. hi i have a really big problem (for me). i have a html5 animation, but actuali is just a html file with a js, this animation was created in edge from adobe, and i got some thing like this: <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="X-UA-Compatible" content="IE=9"/><title>Ribbon</title><script type="text/javascript" charset="utf-8" src=".../muse/assets/ribbon2/Ribbon2_edgePreload.js"></script><style> .edgeLoad-EDGE-4268933 { visibility:hidden; } </style><!--Adobe Edge Runtime End--> </head><body style="margin:0;padding:0;"><div id="EDGE-4268933" "edgeLoad-EDGE-4268933" style="height: 110px"></div></body></html> so in the Ribbon2_edgePreload.js is all my animation code. so in that code i wanna make a call a function in other html and in this case is a masterpage from asp.net in my masterpage i got this function. <script type="text/javascript" > function redMaster(){ var iframe1 = document.getElementById("iframe1"); iframe1.style.display="none"; }</script> the problem is that my animation html file is in the masterpage but inside of an iframe, so when some one click on an animated button i want to hide the specific iframe with that js code but when in the master page add the referecen to the js (<script type="text/javascript" charset="utf-8" src=".../muse/assets/ribbon2/Ribbon2_edgePreload.js"></script>), something really strange happen and the masterpage is changed for the html animation code (this is in the web browser), so i wanna know is there is another way to archieve this. code in the java js (function($,Edge,compId){var Composition=Edge.Composition,Symbol=Edge.Symbol;//Edge symbol: 'stage'(function(symbolName){Symbol.bindTriggerAction(compId,symbolName,"Default Timeline",3974,function(sym,e){sym.stop();});//Edge binding endSymbol.bindTriggerAction(compId,symbolName,"Default Timeline",3595,function(sym,e){sym.stop();});//Edge binding endSymbol.bindTriggerAction(compId,symbolName,"Default Timeline",3703,function(sym,e){sym.stop();});//Edge binding endSymbol.bindTriggerAction(compId,symbolName,"Default Timeline",3839,function(sym,e){sym.stop();});//Edge binding endSymbol.bindTriggerAction(compId,symbolName,"Default Timeline",4153,function(sym,e){});//Edge binding endSymbol.bindTriggerAction(compId,symbolName,"Default Timeline",4153,function(sym,e){sym.stop();});//Edge binding endSymbol.bindTriggerAction(compId,symbolName,"Default Timeline",4206,function(sym,e){sym.stop();});//Edge binding endSymbol.bindTriggerAction(compId,symbolName,"Default Timeline",3500,function(sym,e){sym.stop();});//Edge binding end//custom code modification for the call of the js methodSymbol.bindElementAction(compId,symbolName,"${_Rojo}","click",function(sym,e){red();});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Verde}","click",function(sym,e){sym.play("green");});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Moradoso}","click",function(sym,e){sym.play("purple2");});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Morado}","click",function(sym,e){sym.play("purple1");});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Azul}","click",function(sym,e){sym.play("blue");});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Comisions}","click",function(sym,e){sym.play("red");});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Prorrateo}","click",function(sym,e){sym.play("blue");});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Catalogo}","click",function(sym,e){sym.play("green");});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Ventas}","click",function(sym,e){sym.play("purple1");});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Gastos}","click",function(sym,e){sym.play("purple2");});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Rojo}","mouseover",function(sym,e){sym.play("red");});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Comisions}","mouseover",function(sym,e){sym.play("red");});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Azul}","mouseover",function(sym,e){sym.play("blue");});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Prorrateo}","mouseover",function(sym,e){sym.play("blue");});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Catalogo}","mouseover",function(sym,e){sym.play("green");});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Verde}","mouseover",function(sym,e){sym.play("green");});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Ventas}","mouseover",function(sym,e){sym.play("purple1");});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Morado}","mouseover",function(sym,e){sym.play("purple1");});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Gastos}","mouseover",function(sym,e){sym.play("purple2");});//Edge binding endSymbol.bindElementAction(compId,symbolName,"${_Moradoso}","mouseover",function(sym,e){sym.play("purple2");});//Edge binding end})("stage");//Edge symbol end:'stage'//=========================================================//Edge symbol: 'Symbol_1'(function(symbolName){})("Symbol_1");//Edge symbol end:'Symbol_1'//=========================================================//Edge symbol: 'Symbol_2'(function(symbolName){})("Symbol_2");//Edge symbol end:'Symbol_2'})(jQuery,AdobeEdge,"EDGE-4268933"); function red() { redMaster();} Thank in advance and sorry for my english i still learning.
  18. I went over this plenty of times and no matter how many times I go over it, something goes wrong and I can't seem to figure it out. function validateEmail(email){var atNum=0;for(var i=0; i<email.length; i++){ //Checks for number of @ if(email.charAt(i)=="@"){ atNum++; }}alert("atNum: " + atNum);var atPos=email.indexOf("@");alert("atPos: " + atPos);var lastDotPos=email.lastIndexOf(".");alert("lastDotPos: " + lastDotPos);var user=email.substr(0,atPos);alert("user: " + user);var domain=email.substr(atPos+1,lastDotPos-1); //<-- ISSUEfor(var i=atPos+1; i<lastDotPos; i++){ alert("email.charAt(" + i + "): " + email.charAt(i));}alert("domain: " + domain);var tld=email.substr(lastDotPos+1,email.length-1);alert("tld: " + tld);return false;} This is not fully functioning. Every time I run this, the domain always displays like gmail.com instead of gmail. I even tried to set the lastDotPos-1 to something I know that is suppose to give me gmail, but it still comes out as gmail.com. What is wrong?
  19. I notice when I try to store html code in a variable and there is an ENTER between any code, the code does not work. Example: function displayRegister(){var a='<div></div>';} Code above is fine. function displayRegister(){var a='<div></div>';} Code above does not work. Is there a reason for this?
  20. I am working on a website for my work but they will not give me a webserver. So basically I have to run it off a fileshare. This limits me to HTML, Javascript, and CSS formats to get anything done. I need to be able to accept data entered into a form and store it somewhere so it can later be queried for analysis in another website type format. Any suggestions? Somethings to keep in mind also so you know what I'm working with here. - older dell workstations running XP- IE7 is the only browser we are able to use on the work machines- No web server access or ability to pull in data from outside resources since the machines do not have internet access.
  21. Hi, I'm trying to load a Script once per day using cookies but I can't make it !!I've found this cookies tutorial that opens a pop up once per day <script type="text/javascript">var expDays = 1; // number of days the cookie should last var page = "only-popup-once.html";var windowprops = "width=300,height=200,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes"; function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null;} function SetCookie (name, value) { var argv = SetCookie.arguments; var argc = SetCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : null; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : "");} function DeleteCookie (name) { var exp = new Date(); exp.setTime (exp.getTime() - 1); var cval = GetCookie (name); document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();} var exp = new Date();exp.setTime(exp.getTime() + (expDays*24*60*60*1000)); function amt(){ var count = GetCookie('count') if(count == null) { SetCookie('count','1') return 1 } else { var newcount = parseInt(count) + 1; DeleteCookie('count') SetCookie('count',newcount,exp) return count }} function getCookieVal(offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr));} function checkCount() { var count = GetCookie('count'); if (count == null) { count=1; SetCookie('count', count, exp); window.open(page, "", windowprops); } else { count++; SetCookie('count', count, exp); }} window.onload=checkCount;</script> But, I want to load this script file once per day https://sites.google.com/site/alakwad/file-cabinet/open.js Any help ?
  22. How to implement mvc architecture in js? i have read some stuff regarding this but still having problem to get its implmention.I will be glad if anyone can elaborate it with small example.
  23. I'm trying to get these sliders to work so a user can adjust the readability of the website. i have a slider to adjust the font size, the number of colums and the background color. For the background color i want to have some sort of color picker but i still need to look into that but if you have any suggestions please let me know! here's the code: //fontsizewindow.onload = function() {var value_display = document.getElementById("value_display").className.class="value_display";var lorem = document.getElementsByClassName("lorem");document.getElementById("slider").onchange = function() {value_display.value = this.value;lorem.style.fontSize = this.value + "em";}}//kolom aantalfunction changeColumnNoSlider(event) {var val = event.target.value;document.getElementById('columns-no-value').className='columns-no-value'.textContent = val;var el = document.getElementsByClassName('kolom');el.style.webkitColumnCount = val;el.style.MozColumnCount = val;} The problem is that i use it for blog post so it's not just one article i want to adjust. the code works if i use .getElementById but i need to use classes. Thanks in advance!
×
×
  • Create New...