w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
please make this javascript display toggle work with multiple classes
I think you want this (If you wan't something else then let me know, your uestion is not clear) $(function(){ $('table#items').on('click', 'a', function(e){ $(this).closest('table').find('tr').not($(this).closest('tr')).toggle(); }); }); Put the code in the <head> section between <script> like <head> <script type="tetx/javascript"> // code goes here </script> </head> Also, these <!-- //--> are unnecessary nowadays, we don't live in an ancient age of browsers (IMO) DEMO. Also note that your HTML is broken, check the HTML in the demo. Also, if you don't want to use an id (I've used id='items') for the table then just use $(table) instead of $(table#items).

Categories : Javascript

make several forms with single file inputs on change of a multiple file input using javascript
if I understood correctly, just encapsulate it in a div, then change the html content of this id, in other words: HTML: <div id='myForm' > <form action="upload.php" method="post" enctype="multipart/form-data"> <input id="selector" type="file" name="files[]" multiple> </form> </div> then you can do : $('#selector').change(function(){$('#myForm').html('<form action="upload.php" method="post" enctype="multipart/form-data"> <input id="selector" type="file" name="file </form>')});

Categories : File

Javascript: How do I make a Javascript image link to a page?
Without more information, I'm going to offer this as a relatively cross-browser approach, which will append an img element wrapped in an a element. This works with the following (simple) HTML: <form action="#" method="post"> <label for="imgURL">image URL:</label> <input type="url" id="imgURL" /> <label for="pageURL">page URL:</label> <input type="url" id="pageURL" /> <button id="imgAdd">add image</button> </form> And the following JavaScript: // a simple check to *try* and ensure valid URIs are used: function protocolCheck(link) { var proto = ['http:', 'https:']; for (var i = 0, len = proto.length; i < len; i++) { // if the link begins with a valid protocol, return the link if (l

Categories : Javascript

Javascript show multiple table rows from multiple select
I have fixed the problem myself, the solution was: $('table#newspaper-a tr:not(#header, #trWeekNummer)').hide(); if(List[x].selected) { $('table#newspaper-a tr:not(#header, #trWeekNummer)').each(function(){ $('td:nth-child(1)',this).each(function(){ if($(this).text() == List[x].value) $(this).parent(this).show(); }); }); }

Categories : Javascript

Javascript multiple alerts for multiple fields
Instead of returning false in each if statement, create a var to handle the error validation setting it to false in each failed if statement. Only at the end of your function should you then return true or false by checking that var.

Categories : Javascript

Make sure that one javascript gets run before another
I suggest you manually activate masonry in your main.js, after you did the DOM manipulation: $(document).ready(function() { $('.stamp1').remove(); $('#container').masonry({ columnWidth: 196, itemSelector: 'section', gutter: 8, transitionDuration: 0 }); }); You'll also have to remove the data-masonry-options attribute from your container.

Categories : Javascript

php ftp make multiple directories
Found this, maybe it helps: function ftp_mkdir_recusive($con_id,$path){ $parts = explode("/",$path); $return = true; $fullpath = ""; foreach($parts as $part){ if(empty($part)){ $fullpath .= "/"; continue; } $fullpath .= $part."/"; if(@ftp_chdir($con_id, $fullpath)){ ftp_chdir($con_id, $fullpath); }else{ if(@ftp_mkdir($con_id, $part)){ ftp_chdir($con_id, $part); }else{ $return = false; } } } return $return; } $dir = "/2012/05/02/" if(ftp_mkdir_recusive($con_id,$dir)){ print("Successfully created $dir"); }else{ print(

Categories : PHP

Make javascript use the directory it's in
Use a path relative to your domain, by starting it with /: $.post("/bar.php"); This way it doesn't matter where the script is, or where the HTML file that called it is, only the location of bar.php matters. You should also probably include foo.js the same way: <script src="/foo.js"></script> That will work in both files /index.html and /subdirectory/index.html. Edit: To actually find out where your script is located, relative to the current page, you can use this: (function(){ var myDirectory = (function(){ var script = document.currentScript || // SHIM (function(){ var scripts = document.getElementsByTagName('script'); return scripts[scripts.length - 1]; })(); var src = script.getAttribute('src'); return src.substr(0, src.last

Categories : Javascript

How to make many variables in Javascript
This sounds like a good case for using an array. It's an easy way to store lots of values in the same variable name, but called by an index - a number. Check out the MDN page for arrays. Here's an example of stashing lots of values in an array: var bigNumber = 100000; var myArray = new Array(); var tally = 0; for( i = 0; i < bigNumber; i++ ) { tally += i; myArray[i] = tally; } When this is done, myArray will have 100000 values in it. myArray[0] = 0, myArray[1] = 1, myArray[2] = 3, myArray[3] = 6, myArray[4] = 10, etc.

Categories : Javascript

How to make an alert with Javascript
Yes, there is ClientScriptManager.RegisterStartupScript : http://msdn.microsoft.com/es-es/library/z9h4dk8y.aspx But you better use the available validatos already presents in Asp.Net: http://www.tutorialspoint.com/asp.net/asp.net_validators.htm

Categories : C#

Make Javascript a requirement
I have a PHP site and would want to validate user-inputs with javascript only. That is a realy bad idea, users can submit whatever evil data they want creating a html form and post it to your php files. If you turn off JavaScript and watch this site you will see that some of the functions will work and some don't. You can display a message using the following code: <div id="jsMessage">Please turn on JavaScript</div> <script>document.getElementById("jsMessage").style.display="none";</script>

Categories : PHP

can't make cookie in javascript
var today=new Date(); With Capital D. Update: Run this code on a localhost.

Categories : Javascript

JSP - make end of a src url a javascript variable
You can use javascript to set this. the javascript code below can called when you want to change the image src. function set() { var jsvar= " something" // javascript variable var a = "<%=IMAGEUrl%>"+jsvar document.getElementById("img1").src=a; } here is the image tag <img class="chart" src=" " id="img1">

Categories : Java

How would I make a Javascript timer that goes off once a day
For a javascript web page to put up a prompt at a particular time in the future, you will have to leave a browser running with that page being displayed. Javascript from web pages in a browser only runs in pages that are currently open in the browser. If that's really what you want to do, then you can do so like this: // make it so this code executes when your web page first runs // you can put this right before the </body> tag <script> function scheduleAlert(msg, hr) { // calc time remaining until the next 2am // get current time var now = new Date(); // create time at the desired hr var then = new Date(now); then.setHours(hr); then.setMinutes(0); then.setSeconds(0); then.setMilliseconds(0); // correct for time after the hr where w

Categories : Javascript

Make PHP and JAVASCRIPT work together.
I think that you are using Jquery for the javascript shake, you should call the javascript routine when the page is ready to load <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>shake demo</title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"> <style> #toggle { width: 100px; height: 100px; background: #ccc; } </style> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> </head> <body> <p>Click anywhere to shake the box.</p> <div id="toggle">This is rendered by PHP</div> <script> $( document

Categories : PHP

Can Javascript make changes beyond the browser?
There are several options for persisting data locally in JavaScript: cookies, localStorage, webStorage, and indexed DB. The first two are pretty much universally supported in modern browsers; the last two not quite as well supported. There's a nice article about the first three here. You can also consider keeping data on the server. See, e.g., this thread. There are also third-party packages like persistence.js that provide a higher-level interface to storage that can be either local or web-based.

Categories : Javascript

how can I make XML print multiple listings?
Your search loop only stores the LAST matching node, which means that all earlier matched nodes are simply discarded/ignored. You need to combine the loops, so that as soon as you find a matching node, you start doing the second loop, e.g: for ($i=0; $i<=$x->length-1; $i++) { //Process only element nodes if ($x->item($i)->nodeType==1) { if ($x->item($i)->childNodes->item(0)->nodeValue == $q) { $y = $x->item($i)->parentNode; for ($j = 0; $j < $y->childNodes->length; $j++) { //echoes go here } } } }

Categories : PHP

Make multiple PHP if statements more efficient
Maybe: <!-- divs for right social network icons column --> <div class="eight columns"> <div class="social"> <ul> <?php foreach (array("twitter","facebook","linkedin") as $option) ($tmp=of_get_option('fab_social_'.$option.'_url')) && (print('<li><a href="'.$tmp.'"><img src="'.of_get_option('fab_social_'.$option.'_icon').'" alt="Follow us on '.ucfirst($option).'"></a></li>')); ?> </ul> </div> </div>

Categories : PHP

how to make multiple subset in enum
You really can't. In the end, enum is just a pretty integer. The underlying value of the enum will just be the number you specified. The Enum class provides functionality to convert an integer to an object of your enum type, and back, but it will get confused when you have duplicate numbers. Really the only way to go is to have multiple enum's if you need to differentiate between the values.

Categories : C#

Make multiple slideToggle´s with one script
You can use multiple selectors and then make use the clicked elements id to determine the id of the element to the toggled $('#books, #newspapper').click(function(){ $('#' + this.id + '_view').slideToggle("medium"); });

Categories : Jquery

How can I make multiple markers on a map clickable?
Try this: var marker = new google.maps.Marker({ position: myLatLng, map: map, icon: image }); google.maps.event.addListener(marker, 'click', function() { map.setZoom(8); map.setCenter(marker.getPosition()); });

Categories : Javascript

How to make a loop for multiple plupload
Did not go through the whole logic, but one option should (roughly) be something like this (for 10 uploaders), concatenating the itemIndex to each selector. (watch out for the container item which does not seem to be indexed) Server side, you may encounter the need to know which uploader triggered the upload. This might be solved, for example, with querystring parameters. $(function() { for (var itemIndex=1, itemIndex<10; itemIndex++) initUploader(itemIndex); }); function initUploader(itemIndex) { var uploader1 = new plupload.Uploader({ runtimes : 'gears,html5,flash,silverlight,browserplus', browse_button : 'pickfiles'+itemIndex, container : 'container'+itemIndex, max_file_size : '10mb', url : 'upload.php', flash_swf_url

Categories : PHP

How to make Multiple Request in one HTTPconnection
Have you tried adding credentials to the request to URL 2? UsernamePasswordCredentials creds = new UsernamePasswordCredentials( username, password); request.addHeader(new BasicScheme().authenticate(creds, request)); HttpResponse response = httpClient.execute(request);

Categories : Java

Make multiple forms submission
HTML <form action="handle_user.php" method="POST /> <input type="submit" value="Save" name="save" /> <input type="submit" value="Submit for Approval" name="approve"> </form> Your PHP file will be if($_POST["save"]) { //User hit the save button, handle accordingly } //You can do an else, but I prefer a separate statement if($_POST["approve"]) { //User hit the Submit for Approval button, handle accordingly }

Categories : Jquery

make file multiple executables
As per the standards every directory will contain one Makefile. So you can have three Makefiles for this job done if you have three directories. (d) common | |---(f) common.h |---(f) common.c |---(f) Makefile --- MAkefile for the common folder. (d) app | |---(f) app.h |---(f) app.c |---(f) Makefile (d) unittest | |---(f) unittest.h |---(f) unittest.c |---(f) Makefile (f) Makefile --- invoke all makefiles in the mentioned order. If you want one Makefile to happen all these done, you can do in that way also. Here you have to compile the files by providing paths of the files. order is most impotent.

Categories : C

I want to make 3 or more divs show one after the other using Javascript
Without changing your CSS/HTML, the code below will handle any number of elements, all you have to do is send their IDs as parameter: function showAlternate(ids, interval, currentVisible) { if (currentVisible === undefined) currentVisible = ids.length-1; // last one document.getElementById(ids[currentVisible]).style.visibility = "hidden"; var idToShow = ++currentVisible % ids.length; document.getElementById(ids[idToShow]).style.visibility = "visible"; setTimeout(function() { showAlternate(ids, interval, idToShow); }, interval); } // example usage: showAlternate(["news1", "news2", "news3", "news4", "news5"], 3000); Demo jsfiddle here:

Categories : Javascript

Two different ways to make javascript objects
The normal way of creating an object is the first way. The second way will create two objects, and one will be discarded. One object will be created before the function is called, just as with the first method, but because the function returns another object the first object will be discarded and the returned object will be used instead. An important difference between the methods is that the second one can't use a prototype. Anything that you put in the prototype of the function will be applied to the object that ends up being discarded.

Categories : Javascript

Javascript - make sure one script is done before next is executed
Try this function startSliderAndGrid() { var hashtag = window.location.hash; $('.simpleslide').someOtherPlugin(); $('#home-slider').someSliderPlugin().parents('body').animate({scrollTop: $(hashtag).offset().top}, 500); }

Categories : Javascript

How to make javascript run smooth on Galaxy S3?
Use css transition rather than js for moving things. CSS transitions are GPU optimized while js is all CPU. I can recommend http://rekapi.com/ as an api for this.

Categories : Javascript

How to make this JavaScript code more practical?
I would do it like this use a keyup event var chooseColor = document.getElementById("color"); chooseColor.addEventListener('keyup', function() { document.bgColor = chooseColor.value; }, false); So a little bit on events here https://developer.mozilla.org/en-US/docs/Web/API/Event The keyup event - basically the function provided to the keyup event will be called every time the user releases a key while the input is focused that's because we added the event directly to thechooseColor element The false section of the function is default (it's called /bubbling|bubble|bubbles/ ) and it stops the event bubbling up the DOM Tree, so if it were true the parent(s) of that element will be notified of the event. https://developer.mozilla.org/en-US/docs/Web/API/event.bubbles Demo

Categories : Javascript

How to make an image appear only for 2 minutes using javascript
You're looking for the setTimeout function: setTimeout(function() { // Make the image disappear }, 2 * 60 * 1000); // 2 minutes You can make the image disappear by getting a reference to the img element: var img = /* ...get the image... */; ...for instance, using an id: var img = document.getElementById("theImage"); ...but there are several other ways, on modern browsers you can use just about any CSS selector with document.querySelector (to find the first matching element) or document.querySelectorAll (to get a list of all matching elements). Then either remove it from its parent: img.parentNode.removeChild(img); ...or hide it: img.style.display = "none";

Categories : Javascript

Trying to make my first ajax, but stuck on javascript
A syntax error is occurring on line 38. Do you mean? var type = document.getElementById("type"); var agency = document.getElementById("agency"); Noting the variable assignment and calling the getElementById function of the document object. The location of the code in the markup is fine, but it might be cleaner to either place it at the bottom of the body (last thing before ) or in the head. Also, wrapping it in window's on load event: window.addEventListener('load', function() { // Grab input and AJAX. }

Categories : Javascript

How to make this javascript regex greedy?
(=1)* will match =1=1=1=1=1=1=1=1 If you're looking to match all digits after the = then use abcde=(d+) This will place all the digits into capture group 1.

Categories : Javascript

javascript: how do i make my own testing module?
What you want to set are the type (to "text/javascript") and text attributes. This works if you paste it to your console on this page: // Create an iframe and append it to your document var iframe = document.createElement('iframe'); iframe.height = 400; iframe.width = 600; document.body.appendChild(iframe); // Use this to append your HTML into the iframe iframe.contentWindow.document.body.innerHTML = '<div id="test">This is my iFrame</div>'; // Create an script block and append it to your iframe to sandbox it var script = document.createElement('script'); script.type = 'text/javascript'; script.text = "document.getElementById('test').innerHTML = 'This is cool!'"; iframe.contentWindow.document.body.appendChild(script); Regarding the discussion in comments, I agree tha

Categories : Javascript

How make array Json javascript
You're doing it wrong. Instead of the below line, var cadena = "[" try //to init array var cadena = []; And, instead of this line, cadena = cadena+json; Try this cadena.push(json); And remove this line : cadena= cadena + "]"; For more info, see this question : Appending to array. And you could simplify your code to this : $('.box').each(function () { //taking out the second element of the class and assigning it directly to status_t variable var status_t = $(this).attr("class").split(" ")[1]; var id_t = $(this).attr("id"); var objeto = { "id" : id_t, "status" : status_t}; cadena.push(json); });

Categories : Javascript

How can I make an image map using javascript objects
Have you considered using a plugin like this? http://www.outsharked.com/imagemapster/default.aspx?what.html This helped me immensely on a previous project.

Categories : Javascript

How to make fade in javascript slider?
Yes, there are entire jquery plugins developed for just these types of things. easySlider is one, flexSlider is another. Bootstrap has a slider they call carousel, which while only comes with sliding effects, it's fairly easy to add cross fading.

Categories : Javascript

How can I make a table move in JavaScript?
CSS3 Transformations will not work in IE9 and below since they simply don't support it. If you need to do transforms and the like then one of the many options available is jQuery. jQuery is a JavaScript Library that simplifies your use of JavaScript and makes DOM Manipulations like transformations and animations simpler. They have a number of great demos on their website that should help you get started. I would recommend having a look at their own JavaScript 101 which will help you get started with the basics of JavaScript itself (without jQuery) and then lead you into making your life easier with jQuery. For specifically what you are after (what I assume you are after anyway) you may want to have a look at their events tutorial (attaching click handerls to elements etc.), css styling t

Categories : Javascript

GWT: How to make sure a javascript is run after the GWT page is constructed
While I find it strange that the script doesn't work as intended when moved up in a static page ($(document).ready(…) is supposed to wait for the </html> to be reached –aka DOMContentLoaded– before running the function passed to it), it's not the reason it doesn't work with your GWT application (in other words, your diagnostic is wrong). GWT's onModuleLoad also runs at DOMContentLoaded (or later, but never earlier) so you probably have a race condition between your app's onModuleLoad and jQuery's $(document).ready(…). You could try putting the <script> for your GWT app before the main.js, but because onModuleLoad might run after DOMContentLoader anyway, there's no guarantee it'll work (even less in a crossbrowser way). I think you'd better remove the main.js or replac

Categories : Java

How do you make a blinking animation in Javascript?
You're passing undefined to setInterval (because that's the return value of blinking). Pass a function reference instead: function startBlinking() { window.setInterval(blinking, 2000); //no parentheses here -----^ } Also, fix this typo: getElementbyId should be getElementById (JavaScript is case-sensitive). And always check your browser's error console, you would have caught this one. After you fix both issues, it appears to work: http://jsbin.com/ikubaz/1/edit

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.