w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Get value of HREF for links within a certain Class in Javascript
Use Element.attributes instead of Element.innerHTML. With your HTML you also need to use an inner loop to get <a> children of .r elements: var domains = document.getElementsByClassName('r'); for(var i = 0; i < domains.length; i++){ var anchors = domains.getElementsByTagName('a'); for (var j = 0; j < anchors.length; j++) { alert(anchors[j].attributes.href); } } or you could switch to Element.querySelectorAll() for a nicer querying API: var anchors = document.querySelectorAll('.r > a'); for (var i = 0; i < anchors.length; i++) { alert(anchors[i].attributes.href); } Note that I reused the domains variable since there's no reason to keep re-querying the DOM at every loop iteration.

Categories : Javascript

click multiple href download links
Here's a jquery alternative to what you seek. Window.open should be used for multiple downloads, as window.location will trigger only once in the code run. $('#foo').on('click', function() { window.open($(this).attr("href"),'_blank'); }); $('#foo').trigger('click');

Categories : Javascript

How to dynamically change a parameter of a javascript call from the href attribute of an element
What I would do instead is bind a click handler and use this to figure out which was clicked. $('#myElement').click(function () { console.log($(this).text()); // Should dump "Click me!" to the console. }); You could then add attributes to your links, such as data-someParam="my value" and access them with .attr().

Categories : Javascript

Pass javascript url parameter to html
Try this with url.Actually the below code get data from url querystring.Edit it and give your url. function getUrlVars() { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); for (var i = 0; i < hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; } var me = getUrlVars()["pcode"];

Categories : Javascript

how to pass a parameter by reference in javascript
From MDN JavaScript reference: All types except objects define immutable values. Specifically, strings are immutable. So you have to return an updated string, no in-place edit is permitted.

Categories : Javascript

pass parameter to javascript onload event from php
You can make javascript date object in multiple ways: var d = new Date(); var d = new Date(milliseconds); var d = new Date(dateString); var d = new Date(year, month, day, hours, minutes, seconds, milliseconds); So, one of the options could be: <body onload="countIt(<?php echo strtotime($event->startDate);?>)"> and at the begining of your function: var date = new Date(date); That can work only if your $event->startDate is valid PHP date format. You can learn more about that HERE.

Categories : PHP

pass parameter to a prototyped function in javascript?
I think you're going at it in the wrong way.. you see: The alert is not coming from the last line, it's actually coming from the prototype line, when you do the "new Sub". Maybe a better approach would be something like: function Main() { this.my_object = {"key":123}; } Main.prototype.Sub = Sub; //You set the prototype, but don't actually execute the function function Sub(obj) { alert(obj); } var m = new Main(); //You need to create a new object of type Main in order for it to have access to the method Sub m.Sub(m.my_object); //this should alert the object created in new Main() Does this help? Edit Additionally, you could even do something like this for the Sub function: function Sub() { alert(this.my_object); } Although that way, you wouldn't be able to use the

Categories : Javascript

Javascript Window Function Pass "this" as Parameter
I think what you are looking for is $.each(JSONOBJ, function(key, value){ $('#'+ key).click(function(){ window["minRule"](value); }); }) In your case you are invoking the function minRule in the loop with parameter this where it points to the current functions scope and the value returned by it (in this case undefined as the click handler), that is the reason it is not working

Categories : Javascript

a link pass multiple parameter in zend framework
You have to add "did" to your message route like this: 'router' => array( 'routes' => array( 'message' => array( 'type' => 'segment', 'options' => array( 'route' => '/:action/:id[/:did]', 'constraints' => array( 'action' => '[a-zA-Z][a-zA-Z0-9_-]+', 'id' => '[0-9]+', 'did' => '[0-9]+', ), 'defaults' => array( 'controller' => 'ApplicationControllerIndex', ), ), ), ), ), echo $this->url('message',array('action'=>'delete', 'id' => $message->message_id,'did'=>$message->deliver_id); // output: /delete/1/2

Categories : Forms

How to pass an array of integers as a parameter from javascript to python?
The easiest way to send simple arbitrarily-structured data from Javascript to Python is JSON. You've already got the Javascript side of it, in that JSON.stringify(my_list). All you need is the Python side. And it's one line of code: item_list_json = get_paramw(kw, 'my_list', unicode) item_list = json.loads(item_list_json) If item_list in your JS code were the Javascript array of numbers [1, 2, 3, 4], item_list in your Python code would be the Python list of ints [1, 2, 3, 4]. (Well, you also have to import json at the top of your script, so I guess it's two lines.)

Categories : Javascript

onClientClick calling Javascript Function, can't pass parameter
I thought that the customer's spec for this app required AJAX tabs, after speaking with them, they were open to other options. Now, I'm dynamically creating HTML buttons and am able to call my Javascript that way without issue. Problem resolved.

Categories : Javascript

To pass JSF expression language as parameter to javascript function
If you want to pass a variable from backing bean to a javascript method, Create a variable in beacking bean, say myVariable (add getter method) Add a4j:support to your button as follows, <h:commandButton action="#{workSpaceBean.submit}"......> <a4j:support event="click" onComplete="checkOption('#{workSpaceBean.myVariable}')" /> </h;commandButton>

Categories : Javascript

Java multiple threads - pass parameter to single instance
To spawn a new thread in Java you need to call start() method though you override run() method. By this I mean: class ClassA implements Runnable { ... } //Creates new thread (new ClassA()).start(); //Runs in the current thread: (new ClassA()).run(); Calling run() will execute the code in the current thread.

Categories : Java

How can I pass multiple parameter to restful webservice using http post
The problem is that the JSON being sent in the HTTP Request body is marshaled to the first method parameter. Your other parameters are not annotated as to where they are coming from in the request, which is why you are getting the error: ItemFacadeREST contains multiple parameters with no annotation. Your best option would be to combine the parameters into a single JSON object; something like: { "id1":[ "string1", "string2" ], "id2":[ "string3", "string4" ], "oo":[ { "object1":"" }, { "object2":"" } ] } And then change your method to: @POST @Path("Test3") @Produces("text/plain") @Consumes({"application/json"}) public String Test3(MyJsonObject json) { //Pars

Categories : Java

Using CGI methods to pass a parameter from JavaScript to Perl script over a web server
"When in localhost, clicking on test.html" says to me you might be accessing the page with a file: url, which will keep XMLHttpRequest from working. You also want to use a standard javascript library instead of native XMLHttpRequest calls. Most of the world uses jquery these days.

Categories : Javascript

Javascript pass parameter to eventListener function whilst in loop
You do that by using a builder function: window.onload = function () { var el = document.getElementsByClassName('modify'); for (var i = 0; i < el.length; i++) { var getId = el[i].id.split("_"); document.getElementById("modify_y_" + getId[2]).addEventListener('mouseover', makeHandler(getId[2]), false); } function makeHandler(theId) { return function () { document.getElementById("modify_x_" + theId).style.borderBottom = '#e6665 solid 3px'; }; } }; The function returned by makeHandler closes over the theId argument, which doesn't change.

Categories : Javascript

Array parameter Vs direct parameters to pass to Javascript function
You don't need the array overload as you can already access passed arguments from the arguments array. Anyway, you shouldn't worry about a small potential performance difference.

Categories : Javascript

How to pass parameter with javascript function using OnClientPopup of ajax dropdownextender
Finally i got a solution for this problem.Ajax:dropdownextender doesn't support any parameters in java-script function on OnClientPopup.But we can pass parameters in java-script.Just add function on page load. Ex.- string func = "function docall(){showDataCombo('" + txtDisplay.ClientID + "','" + divGrid.ClientID + "','" + Table1.ClientID + "','" + txtSearch.ClientID + "','" + hfScrollPosition.ClientID + "','" + gridEdit.ClientID + "','" + lblTot.ClientID + "','" + Hidden_RowIndex.ClientID + "','" + divComboContainer.ClientID + "','" + DropPanel.ClientID + "');}"; ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", func, true); DDE.OnClientPopup =

Categories : Javascript

Parameter starting with a zero digit not pass correctly to JavaScript function
Your number is potentially being treated as octal, although that behaviour may be browser specific. In any event, the leading zero will not be preserved. You will either have to do without the leading zero, or pass your parameters as strings.

Categories : Javascript

a href Links are wider than they should be
The div with learn class is having a block display so browser will adjust the outer <a> as as display block and occupy the available width. Change div display as inline-block then you can see the width of <a> coming as 215px here is the example code <html> <style> .inside { width: 1014px; margin: 0 auto; overflow: hidden; } #people .learn { display: inline-block; background: url(http://www.domain.com/images/learn.png); width: 215px; height: 51px; margin: 30px 0 0 20px; padding: 0; border:solid 1px ; } </style> <div id="people"> <div class="inside"> <div class="headline"><span class="bold">Best</span> Webhosting Around. Period.</div>

Categories : CSS

How do I pass in a cookie value returned from a javascript function to a JSON parameter field?
It looks like you're using jQuery so if you have a ready function you could set these values into your data object like this var data: { awardTitleId: e.data.AwardTitleId, //wherever you get this from personId: null, nameId: null } $(function(){ data.personId = readCookie("personId"); data.nameId = readCookie("nameId"); }); I'm not sure where your data object exactly lives, hopefully not at the global scope but you mention needing that globally earlier so that's where I've left it. By assigning the personId and nameId in the ready function of the page then you will have them for the life of the page and won't need to continually get them from a cookie.

Categories : Javascript

javascript pass function name as parameter not working with jquery show hide
It would work like this: var showOrhide = function(doThis) { $("#myDiv")[doThis](); }; if(a) { showOrhide('hide'); } else { showOrhide('show'); } Hoever, it's still extremely ugly. jQuery has a toggle() method that accepts a boolean argument which would be much more appropriate: $("#myDiv").toggle(!a);

Categories : Javascript

bouncing images with href links
Seems like a trivial old obtrusive script. general solution In function loadBouncingImages2() find where setLayerHTML() is called and change its second parameter to whatever HTML string you need. It could be altered to '<a href="...">'+getImgTag(...)+'</a>'. universal solution replace the setLayerHTML call to var img = getImgTag('bouncingImagesImg' + layerLoop,imagesDetails[layerLoop].src,imagesDetails[layerLoop].width,imagesDetails[layerLoop].height,0); setLayerHTML(imagesDetails[layerLoop].layerObj,'<a href="'+imagesDetails[layerLoop].href+'">'+img+'</a>'); and after that, just modify the configuration by adding href to imageDetails, like imagesDetails[0].href = 'http://www.google.com';

Categories : Javascript

Is there a way to tell if an end user will be able to handle links?
As far as I know detecting what capabilities / applications a user has can be tricky for security reasons, but you can rule some things out and go from there. You could try see of its a mobile browser which can handle the link, and then if not, see if the other device is capable of using a telephone number, e.g. Skype, and again if not, just display a normal number. this combines answers from these questions a href tel and standard browsers and Javascript to detect Skype? <div> <?php if(strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'mobile') || strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'android')) { echo '<div id="tel"><a href="tel:123456">123456</a></div>'; }else{?> <script> function skype (failureFunction) {

Categories : HTML

Href and mailto links in KnockoutJS
Using the attr and text properties in the data-bind attribute like so: <script type="text/template" id="customerSearchDisplayTemplate"> <tr> <td class = "hiddenId"><span data-bind="text: customerSearchID"/></td> <td><span data-bind="text: fullName" /></td> <td> <span> <a data-bind="text: primaryEmail, attr: {href: 'mailto:'+primaryEmail()}" /> <span/> </td> <td> <span> <a data-bind="text: secondaryEmail, attr: {href: 'mailto:'+secondaryEmail()}" /> <span/> </td> <td><span da

Categories : Knockout Js

Loop through all links and find the href
use jQuery.each to loop through more than one. Using your Fiddle: var $hrefs = $('#myLinks').find('a[href]'); var $myDivs = $('#myDivs'); $hrefs.each(function(index,link){ $(link.hash,$myDivs).css('background-color','yellow'); }); You could also use map (fiddle): var hrefs = $('#myLinks').find('a[href]') .map(function(){ return this.hash; }) .get(); $('#myDivs').find(hrefs.join(',')).css('background-color','yellow');

Categories : Javascript

how do I pass a parameter to a javaScript function which comes from the BasePage of my web page, on a click button event?
One way I can think of, is to either pass the UserId property as cookie inside the HtmlResponse that's returned when the page is first sent. Another way, is to pass it inside an Asp.NET tag on the page load. Just add this inside the 'body' of the page: <input type="hidden" id="user_id" name="user_id" value="<%= base.UserId.ToString() %>" />

Categories : C#

Qr code generates different links with 2 parameters (img != href)
Maybe the mailbox skips the last parameter, it is sometimes hard to predict (gmail alters the HTML). I think you should URL-encode the whole URL, because the character ? might be the cause of the problem. This would be string resetLink = "http://chart.apis.google.com/chart?cht=qr&chs=300x300&chl= http%3A%2F%2Fsite.com%2FAccount%2FValidate%2F%3Fparam1%3D" + model.UserName + "%26param%3D" + model.Token I also replaced the ampersand before chl you encoded by its real character.

Categories : Asp Net Mvc

Replace all links(href) in a web page using jquery
Try this: $('a[href*="sites.com"]').each( function(){ // Do a substring here to keep the beginning of the path (domain) $(this).attr("href", "http://any.sites.com/"); })

Categories : Javascript

Javascript: How to use apply method to pass array of parameter and then access it inside the called function
Try: function callMe() { var s = ""; s += arguments; return s; } You can also access the single parameters by index as in arguments[0], arguments[1], etc. To append a string representation of the argument list, you need a proper array: s += Array.prototype.slice.call(arguments);

Categories : Javascript

Bootstrap popover doesn't show href links
Here is the solution to diplay HTML content in the popover. Refer this demo JSFiddle HTML : <button class="btn btn-default" data-placement="bottom" data-toggle="popover" data-container="body" type="button" data-original-title="" data-content='<a href="#">This is link</a><br><a href="#"><b>&quot;This is link 2&quot;</b></a>' data-trigger="click" id="example"> Click to Popover bottom</button> JS: $('#example').popover({ html:true//, //content:'<a href="#">This is link</a>' });

Categories : Twitter

href links not working when nested in data section
Did you try this one? input type="button" name="Release" onclick="document.write('<?php the_permalink() ?>');" value="Explore" Its a different approach of the href.

Categories : HTML

how to make href links fire C# methods when clicked
You would have to create a C# webmethod or WebAPI which you would use ajax to call. You can not access a C# method directly from html or javascript unless you are using something like a server side control (LinkButton) which you could then add a C# handler for the click of that button. So client side your 'onClick' would execute a javascript function. The Javascript function would call the C# webmethod, passing in the parameters, then onSuccess you would have the results and do with them as you please.

Categories : C#

href links to Bootstrap nav tabs not activating on same page
Here is a generalized example which will work with nav-pills and nav-tabs Allows any link to also control the tabs for that "on-page" navigation. HTML <a href="#aaa" class="control-tabs">Another Link a</a> <a href="#bbb" class="control-tabs">Another Link b</a> <ul class="nav nav-tabs"> <li><a href="#aaa" data-toggle="tab">AAA</a></li> <li><a href="#bbb" data-toggle="tab">BBB</a></li> <li><a href="#ccc" data-toggle="tab">CCC</a></li> </ul> <div class="tab-content" id="tabs"> <div class="tab-pane" id="aaa">...Content...</div> <div class="tab-pane" id="bbb">...Content...</div> <div class="tab-pane" id="ccc">...Content...<

Categories : Javascript

jQuery find phone numbers on page and wrap in links
You can replace all instances of your phone number with regex js var text = $("body:first").html(); text = text.replace(/(phone-number)/g, "<a href="tel:$1">$1</a>"); $("body:first").html(text); html <div id="departments"> <ul> <li> Department 1 - phone-number</li> <li> Department 2 - phone-number</li> <li> Department 3 - phone-number</li> </ul> </div>

Categories : Jquery

Jquery Highlight Active Link works for Href links but not Menu Items
You need to get the Menu client id when you get it on client. Try using the following code snippet: <script type="text/javascript"> $(document).ready(function () { var url = window.location.href; url = url.substr(url.lastIndexOf("/") + 1); $("#" + "<%= NavMenu.ClientID %>").find("a[href='" + url + "']").addClass("selected"); }); </script>

Categories : Jquery

Using selenium webdriver, how to click on multiple random links in webpage one after another continuously to detect broken links?
When testing for a bad page, I usually test for the title/url. If you are testing a self-contained site, then you should find/create a link that is bad, and see what is unique in the title/URL, and then do something like: assert(!driver.getTitle().contains("500 Error")); If you don't know what the title/url will look like, you can check if the title contains "500"/"404"/"Error"/"Page not found" or if the page source contains those as well. This will probably lead to a bunch of bad pages that aren't really bad (especially if you check for the page source), and will require you to go through each of them, and verify that they really are bad

Categories : Python

Adding Parameter to href tag before uri
Try like this(not shure what the r:url tag does though) href="<r:url uri="utb:open" mode="view" lateBinding="true" />&disp=true" P.S. posting the error could help.

Categories : Misc

pass multiple arrays and values into javascript function
Well, you could use the toString Javascript function http://www.w3schools.com/jsref/jsref_tostring_array.asp

Categories : Javascript

Pass current GET Variables with href
Use parse_url. It returns an array like: $out = parse_url('www.example.com/?par1=test'); var_dump($out); Output: Array ( [path] => www.example.com/ [query] => par1=test )

Categories : PHP



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