w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Secure database and webpage against modification
In this case i would make sure to harden the system itself as good as possible. This includes a very broad spectrum reaching from Security Roles over transaction based usage of the database, logging as well as the prevention of all sorts of attacks like SQL injection, cross site scripting in general and maybe if its a that sensible system use certificates and general IP checks (like have a white list of IPs that are allowed to populate requests to the system that do not instantly get refused). Not to mention your Host architecture has to be protected regardless of the implemented security features inside your system (key words: firewalls, user privileges etc.). During the development process there should always be auto code checking software (like Sonar) running to detect logical errors an

Categories : Database

How do you embed a certain element from a webpage with JavaScript?
How about: $("#YourElementId").append($('#comm')); Using JQuery, can't you just append the element? Expanding on the comment by @Omar, you could also append a clone of that element if you want it duplicated instead of relocated: $("#YourElementId").append($('#comm').clone());

Categories : Javascript

Watch for element creation in greasemonkey script?
MutationObservers are called for more things than just adding nodes, including changes to attributes and removing nodes. So watch out for mutation.addedNodes returning null - in which case this code will fail. Try: if (mutation.addedNodes && mutation.addedNodes[0].getAttribute('class') === 'nav') { ... The mutation object also has a 'type' attribute that you can use to get more info; have you read the API docs on MDN? There are some good examples there.

Categories : Javascript

replacing text between two strings in javascript using greasemonkey
The easiest way to do this would be with a regular expression. var comment = "[youtube]http://www.youtube.com/embed/XGSy3_Czz8k[/youtube]", match = comment.match(/[youtube]([^[]*)[/youtube]/); if (match) { var iframe = document.createElement("iframe"); iframe.src = match[1]; document.body.appendChild(iframe); }

Categories : Javascript

How can I submit this form properly with javascript/greasemonkey?
With jQuery you could submit this form like this: In this function you can process the data of the form. $(document).on("submit", "form", function(e){ e.preventDefault(); // get the data of the form var url = $(this).attr("action"), _csrf_token = $(this).find("input name=['_csrf_token']).val(); // jquery ajax call for example $.ajax( ); });

Categories : Javascript

Removing CSS Borders with javascript in greasemonkey/tampermonkey for facebook
border-right is a style property, not an element attribute, so removeAttribute won't work. Instead try this: document.getElementById("mainContainer").style.borderRight = "none"; (Note that border-right becomes borderRight for JavaScript, and make sure you spell names exactly.) However you might prefer user stylesheets. Browser extensions such as Stylish let you write CSS that is applied automatically, instead of going through script. (You can hide things using display: none, or mute them with opacity: 0.5.)

Categories : Javascript

Adding javascript to a XML file transformed with XSLT using a Greasemonkey script
Don't use onclick. This goes triple for userscripts, as there are additional scope and/or sandbox conflicts. Also, it's a poor idea to try and add JS into the XSLT file/text, and there is no need for script injection in this case either. Use the script to do whatever JS manipulation you have in mind. For example: // ==UserScript== // @name _XML Renderer with javascript functionality // @description Stylesheet and javascript for xml results // @include http://YOUR_SERVER.COM/YOUR_PATH/*.xml // @resource xslFile Q_17998446_transform.xsl // @grant GM_getResourceText // ==/UserScript== var xsl_str = GM_getResourceText ("xslFile"); var processor = new XSLTProcessor (); var dataXSL = new DOMParser ().parseFromString (xsl_str, "text/xml"); processor.importSty

Categories : Javascript

Passing an jQuery element cache to a method for modification
Use Jquery On to bind events at an element high-up in the DOM that is always present. http://api.jquery.com/on/ This is the simplest way to handle event binding to dynamically created elements. here is a jsfiddle that shows an example. $('#temp').on('click', 'button', function(){ alert('clicked'); }); $('#temp').append('<button>OK</button>'); The event is bound to a div, which later has a button dynamically added. Because the button has no click event, the event "bubbles" up the DOM tree to its parent element which does have a click event for a button, so it handles it and the event "bubbles" no further.

Categories : Javascript

Select all instance of a word in a rendered webpage
Or, if you want to use AngularJS, you can use a filter and binding: Click: <div style="border: red thin solid; width: 100px; padding: 10px;"> <div ng-repeat="word in words"> <a ng-click="$parent.selectedWord = word">{{word}}</a> </div> </div> Selected: <div style="border: red thin solid; width: 100px; padding: 10px;"> <div ng-repeat="word in words"> <span ng-bind-html-unsafe ="word | highlightWord : selectedWord"></span> </div> </div> Selected Word: {{selectedWord}} and: app.controller('MainCtrl', function($scope) { $scope.words = [ "beer", "wine", "whiskey", "vodka", "gin", "rum" ];

Categories : Javascript

Scraping webpage sentences beginning with certain word
Use a regular expression to match specific text contents: import re soup.find_all(text=re.compile('^s*Text Start:.*')) Demo: >>> from bs4 import BeautifulSoup >>> soup = BeautifulSoup(''' ... <div class="class"> ... <div class="time"> ... <span class="date">07/02/13</span> ... <span class="sep">|</span> ... <span class="duration">02:15</span> ... <div class="clear"></div> ... </div> ... Text Start: This text changes each time, 5-4 ... </div> ... ''') >>> import re >>> soup.find_all(text=re.compile('^s*Text Start:.*')) [u' Text Start: This text changes each time, 5-4 ']

Categories : Python

Javascript modification at the browser Interface
If you have secrets to hide, don't include them in your Javascript. Yes, it's quite possible. With something like Greasemonkey, or a browser plug-in, the user could certainly transform the source before executing it. Moreover, since your source is eventually delivered in plain text, even if obfuscated, the user can reverse engineer it to find the secret, and often can do so quite quickly.

Categories : PHP

can i display excel and word document from base64 encoded data to webpage?
Are you using embed for the word docs as well? Try using object as below: <object data="file:///C|/myfile.doc" type="application/msword" style="width:100%;height:100%;"></object>

Categories : PHP

how can i make my custom html webpage the index page of my word press site
It will need to be a php page within your theme folder. You will then need to declare it as a template file by doing the following: <?php //Template Name: Homepage Template get_header() ; ?> Create a new page and assign the Hompeage Template. It your wordpress reading settings you will to set Your latest posts to a static page and select the page you just created.

Categories : HTML

Load json url parameters code (javascript modification)
It's because the only thing your test function does is adding an event listener to the click event of the #charger input. Just take your initial code as is and put it in the seperate js file and that should do the trick. Also, make sure that the jQuery script get's loaded before your other script.

Categories : Javascript

JavaScript string modification (Probably involves regular expression)
I would use this to get the extension: someString.substring(someString.lastIndexOf(".")) you also asked for some code review, so: 1 - Your JS conventions are a little off, it looks more like C# :) Why the capital letter in variable and method names? 2 - You said you can go with the quotes option instead of using ~1, seems easier, why did you decide not to? 3 - Why do you need something like this in your JS?

Categories : Javascript

How word can be extracted after another word in javascript with regex?
The code is fine. The problem is only in the alert. If the match succeeds, the [match] method returns an array and updates properties of the regular expression object. The returned array has the matched text as the first item, and then one item for each capturing parenthesis that matched containing the text that was captured. Therefore, you should look inside the array: alert(found[1]); This will fail, however, if there is no match, because match returns null in that case. So we need a default value as well: alert((found || [])[1]); One more more suggestion which would have made your problem immediately obvious from the start: use console.log() instead of alert() for debugging.

Categories : Javascript

jQuery - Find a word within a span and take that word and add the class to the span element
jQuery("this:contains('hat')") supposed to be jQuery(this).filter(":contains('hat')") this when inside the quotes does not correspond to element or context. It is supposed to be used without the quotes jQuery(this) and not jQuery("this") JS jQuery(".product span").each(function() { // cache the jQuery object var $this = jQuery(this); // check the length if it returns anything if($this.filter(":contains('hat')").length) { $this.addClass("hat"); } else if ($this.filter(":contains('sunglasses')").length) { $this.addClass("sunglasses"); } else { $this.addClass("vest"); } }); Check Fiddle

Categories : Jquery

Want to scroll a DIV element, not entire webpage
You are animating the body element. You need to animate the target div. Also, I would consider either shortening the ID on that element to make it more manageable or target the element using one of the classes. Either way, try using the code in that last snippet but put the nested list inside of the first selector and the child element to which you want to scroll in the scrollTop attribute's selector.

Categories : Javascript

Replace Word Within Word - Javascript
You are creating a copy of string when replacing, so you must assign the result of .replace() back to x.id. var x = document.getElementById("facebookCheckbox"); x.id = x.id.replace("Checkbox","");

Categories : Javascript

With HtmlAgilityPack, verify that element on webpage exists
Method LoadHtml(html) loads string, which contain html content for parsing. This is not url of resource to load. So you are loading string "http://google.com" and trying to find logo in it. Which of course gives you not there result. You can use WebClient to download resource content: WebClient client = new WebClient(); string html = client.DownloadString("http://google.com"); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(html);

Categories : C#

Extracting a value from webpage element with selenium, fiebug, xpaths
Humm.. You can try the below : @driver.find_element(:css,"input#dateTxt").attribute("value") #=> "Thursday June 20" @driver.find_element(:xpath,"//input[@id = 'dateTxt']").attribute("value") #=> "Thursday June 20" Look at the below page Element examples: and Selenium::WebDriver::Element#attribute

Categories : HTML

Convert Word to HTML then render HTML on webpage
We use http://www.aspose.com/ (I think the one we use is Aspose words) to perform s similar task, and it works quite well. (there is a cost involved) I would suggest that converting to HTML gives the worst rendition of the document. One solution we use, is to generate a Jpeg image of the document and display that. If you need to be able to perform operations like find and copy/pasting text - I would recommend converting the document to a .pdf, and displaying it inline, in whichever standard pdf viewer the client machine has installed.

Categories : C#

How to determine connected to network vs online in javascript
this feature sounds bleeding edge. so, if you merge information ping from your server, and the connection type you can determine when are you really online and when are you just connected over Wi-Fi. but first, check this out: How do I check connection type (WiFi/LAN/WWAN) using HTML5/JavaScript?

Categories : Javascript

Javascript - Add and retrieve data from MS Dynamics CRM Online
The two ways to interact with Javascript and CRM is via either OData, or SOAP services. The easiest method is to use OData if possible. The problem you're going to run into is Authentication with Odata. OData Access is not supported outside of CRM javascript and Silverlight. (Although I use LinqPad to create my Odata queries, and it queries CRM with it just fine, so I'm not sure what that's all about) The common method for getting around this is writing your own Webservice that authenticates to CRM, and then uses the SDK to retrieve and update the data, exposing it to you in a restful manner. As Guido points out, you should be able to use SOAP requests from Java, but I've only ever done this from within CRM as well, and I'm not sure what authentication issues you will face as well.

Categories : Javascript

How can I access an online JSON file from offline? (javascript)
Yes, you can use JSONP for this. I'm not sure if Wunderground Weather API have some kind of callbacks in JSON. But if they do even jQuery getJSON support JSONP. Seems like you run into Same origin policy.

Categories : Javascript

Javascript: measure code execution time online
One option is jsperf.com OR //works in chrome and firefox console.time("myCode"); // 'myCode' is the namespace //execute your code here console.timeEnd("myCode"); OR var startTime = new Date().getTime(); //execute your code here console.log(new Date().getTime() - startTime);

Categories : Javascript

Javascript scroller works on local server but not online (jsScroller.js)
I can see this error in my console when i opened the link Uncaught ReferenceError: jsScroller is not defined that means that you have not included the js file or your path to js file is wrong. correct that it will surely work.

Categories : Javascript

How can I remove a some javascript from my webpage?
As has been mentioned in the comments, you can't get rid of javascript once it has been loaded. With that being said, if you wish to undo the changes made by the script you posted above, the .off() function will unbind all attached to a handler (so if any other events are attached to click, they will be removed to). e.g. the following will unbind the functions from the click events on $('#loadEmbScrpt') and $('#remEmbScrpt') : $('#loadEmbScrpt').off('click'); $('#remEmbScrpt').off('click'); or if you want it all in one line: $('#loadEmbScrpt,#remEmbScrpt').off('click'); Let me know if that solves your problem

Categories : Javascript

Calculations on webpage using javascript
As per what i have understood by your last comment. You should have different ids for third and fourth box i.e. #val3 , #val4 respectively. So it would be somewhat like this. See this updated FIDDLE of yours. Entering the value 4,5,10,5 respectively in the 4 boxes, your subtotal would be 70 as expected. Just a note: call the function calcSum only when all the four fields are provided. Put the conditions over there otherwise it would return NaN(not a number) even if one field is missing. if(val1 && val2 && val3 && val4){ // do your calculation and return the sum } else{ alert("please fill all the fields :)"); }

Categories : Javascript

A way to exec javascript on a webpage with C#
simply you can use yourControl.ClientID <script type="text/javascript"> document.getElementById("username").value = document.getElementById('<%= yourControlName.ClientID %>').value; </script> if you want to reach that controls from server just add runat="server" to your textbox so you can reach it from server. <form runat="server"> <input type="text" id="username" runat="server" /> </form> note: you can only have one form tag with runat="server" attribute

Categories : C#

Collecting online statistics for a non-online game
Depending on the platform you are going to write the game on, but I have used Flurry Analitica and it worked for my mobile games like Flurry Analitics

Categories : Web Services

how to show the alert box when half of the time finished in online exam using javascript
I think you have total number of questions with you. When the user answering each question u can increment a temp variable. then check whether that temp equals to half of your total questions then u can give an alert. like . alert("Half of the test completed");

Categories : Javascript

Webpage not found javascript error
There is a location object which when assigned to, changes the location of the page: location = 'http://www.google.com'; // goes to Google homepage Usually, to avoid confusion, it is usually referred to using window.location, but since window is simply the global object, reassigning location will make the page go to the URL that is the value of the string. To solve the issue, simply rename the variable: var myLocation = "Syrdsase va"; var name = "bob sixlet"; var age = 14; document.write(name + ", " + age + myLocation);

Categories : Javascript

Local Webpage on iPad with Javascript
You're asking for two features that have been introduced with HTML5: Offline web applications to make your page accessible even without an Internet connection Local storage to save your page's data on the client

Categories : IOS

AJAX / Javascript fails to update webpage
I recomend you to use Jquery it is simple: include in you html within the head tag: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> then change your javascript function by the following: function LoadManagerForm() { document.getElementById('insert_response').innerHTML = "Loading..." nocache = Math.random(); $.post( '../forms/managerform.php?nocache='+nocache, { nocache : nocache }, function(response) { document.getElementById('insert_response').innerHTML = response; } ); }

Categories : PHP

How to run Javascript and jQuery in Firefox on an external webpage?
As @robertc suggested, Greasemonkey can be the only solution. https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/

Categories : Javascript

How do I alternate letter colors on a webpage using javascript?
Replace this: var text = HTML.split(' '), output = ''; for (var w=0; w<text.length; w++) { output += '<span style="color:' + ((w%2) ? colorpair[0] : colorpair[1]); output += ';">' + text[w] + '</span> '; } With this: for (var c=0; c<HTML.length; c++) { output += '<span style="color:' + ((c%2) ? colorpair[0] : colorpair[1]); output += ';">' + HTML.CharAt(c) + '</span> '; } The output's going to be pretty verbose. If you want to skip spaces, you'll need to add a little logic for that.

Categories : Javascript

calling function in the javascript written in webpage(.cs)
On your url try : "PageName.aspx/MethodName". Also check out this blog post by Dave Ward : Using jQuery to directly call ASP.NET AJAX page methods

Categories : C#

SharePoint 2013 Online HTML5 Javascript Upload to Document library with CSOM/Javacript
Yes, I'm actually doing that right now (uploading images to a document library - and changing property values of that document once its been successfully uploaded) I found this link very useful: http://technet.microsoft.com/en-us/dn769086(v=office.12) I had an issue with the "fileCollectionEndPoint" and the "serverRelativeUrlToFolder" variables, I changed the value to: var serverRelativeUrlToFolder = 'YOUR_DOCUMENT_LIBRARY'; var fileCollectionEndPoint = String.format("../../_api/web/getfolderbyserverrelativeurl('{0}')/files/add(overwrite=true, url='{1}')?@target='{2}'", serverRelativeUrlToFolder, fileName, _hostweburl); That's just what worked for me - YMMV, the TechNet code may work OOB for you. Handling the restriction of filetypes... you can use a client side method of checkin

Categories : Javascript

I want to find the word and replace the 3 word after the search string with my desired word in batch script
You were close. See mods to your code below. If you really want the first word after wordB... this will do it. Don't enable delayed expansion if you don't need it because that just messes you up if there are ! in the text. @echo off SET InFile=test.txt FOR /F "tokens=*" %%A IN ('FINDSTR "wordA" "%InFile%" ^| FINDSTR "wordB"') DO CALL :FindString "%%A" pause goto :eof :FindString SET String=%~1 SET String=%String:*wordA =% SET String=%String:wordB =% FOR /F "tokens=1" %%A IN ('echo.%String%') DO ECHO.%%A :goto :eof

Categories : Batch File



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