javascript

JavaScript security puzzle with XSS

I am working on implementing a JavaScript web bug that will be inserted into our client's web pages. One of the features our clients would like, is a way to pass pieces of the HTML on their web pages to our server through the web bug. We are using JSONP and the server that is hosting the JavaScript web bug is different than the server ho...

dynamic jquery question

I am doing the following to toggle the display of an element: $("*[id^=" + id + "_]").toggle(); // id is the element to toggle This then toggles everything of the form id_* where * is any string. I now realized, that I don't want to simply toggle each element, but show or hide it based on the state of the clicked element. How can I ...

How to get a variable returned across multiple functions - Javascript/jQuery

This question in summary is to figure out how to pass variables between javascript functions without: returning variables, passing parameters between primary functions, using global variables, and forcing function 1 to wait for function 2 to finish. I figured out a jQuery solution and posted in below (in the answers section). Old Pos...

Javascript Problem with Variables

I have created a function to showing a title text in a separate div, its wotks perfectly, but a have problems with "title" attribute, so i wonna delete it after tooltipp wenn be displayed. And on mouse ou show it agaiin, but the variable tooltipptext is empty... same one an idea? var tooltipptext; $(".infoimg").hover(function(event)...

Creating dropdown with the first option only as heading.

I want to create a dropdown in such a way that the first option should be avaialable only as a heading. eg: more Sectors Sector1 Sector2 While displaying the dropdown it should be shown with "more Sectors " as the heading.On clicking the dropdown for selecting a particular option, the option "mor...

How does Facebook set Cookies with FB Init call in "Facebook Connect" setup?

Two part question: I have setup my website to use Facebook Connect for logging in. In the restricted area, I check if there is a cookie set with the name, "fbs_" under my domain name. However, I do not understand how this cookie gets set under my domain name. Does anyone know what happens with FB.Init call in this regard? (I have not us...

Firefox bug - dynamic input element

Bug: http://www.chubbyfish.co.uk/bug.html I'm dynamically creating the 3rd input field, and then adding a value to it (of "input 3 value"). Refresh the page several times and you'll see input4 and input5 get filled up with the same value. Why? Any ideas?! If you can fix it I'll buy you a luxury yacht and a new house! ...

Basic jTemplate not working

I'm using jTemplate & jQuery to query a .net Web Method, then display the results in a webpage. Shown below is the HTML where it all happens, the DIV with the class Template is my template. Then the actual results get put into the DIV with the class Results. <div id="SharepointDocumentSearch" style="display:none;"> <p> Docu...

Should I write script in the body or the head of the html?

I have seen both ways, both implementation work just the structures are a bit different. In your experience, which work better and why? ...

Need help with Javascript html parser for specific needs.

My problem is bit complex, I will try my best to explain it. What I am trying to do? I want to provide users with a script that they can add to their webpage/blog which will highlight cretain text on their web pages and put a menu/box their which displays on hover. Something like kontera. To do this, I am doing the following: 1. Pa...

ASP.NET RegisterClientScriptBlock, RegsiterStartupScript issues

I am working on a set of ASP.NET applications using a master page. When I try to register a clientscript - an alert box for instance, in the Page_Load it works fine. However if I try to do the same from any method or event handler of the same class it doesn't. Also, it doesn't seem to matter which Register method you use, both work only ...

How can I check or get the toolbar value of a browser with Javascript.

I want to find out in Javascript if the toolbar property value of a Browser is either Yes or No. I know how to set it with a windows.open toolbar=no but I want to know how can I retrieve that value using Javascript. Thank You ...

Load array from PHP via jQuery.ajax

OK, so I want to get a row of data from a DB via jQuery.ajax() Here is the code where I want to load it: $.ajax({ url: 'mypage.php?id=345', success: function(data) { //process array of data } }); Here is the code on the page that jQuery is loading from: $DBH = new PDO(DB_DSN,DB_USER,DB_PASSWORD); $STH = $DBH->("SELECT * F...

jQuery DataTables server-side processing using ASP.NET WebForms

Problem: jQuery DataTables server-side processing using ASP.NET WebForms. Solution: Darin Dimitrov answered the question using an example which pages and sorts, but doesn't do any searching. Here's my **basic** modification of his work to make searching work on his example: public class Data : IHttpHandler { public void ProcessRe...

How to bring focus to a text field when you hover over it

How do you bring focus to a text field when you hover the mouse on top of the field? ...

Getting undefined error when using Request.QueryString() to get variuable value

I am using the following code to open a popup window and passing the ID of as query string. <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <script language="javascript" type="text/javascript"> function openwindow(divID) { window.open("pp.html?id="+divID+"","","status=yes, location=yes, width=700, height=400"); } </...

Another jquery dynamic selector

I just asked a question here about selecting all id's of the form id_* where * is any string and id is the id of the element. I got a great working solution: $("*[id^=" + id + "_]").each(function() {... // id is the element name I need to take this one step further now: All of my ids will be of the form: a_b_c ... where a b and c are...

Jquery: Select all H2 tags on page, copy the text of those H2 tags to a list.

Is there a very simple way to select all H2 tags on the page, then take the text in those H2 tags and add the text of each one to a list. example: <H2>I'm number one!</H2> <H2>I'm number two?</H2> <H2>I'm number three.</H2> the script will grab those, and copy their contents into a list when the page is loaded: <UL> <LI>I'm number o...

.chm and Sandcastle 2010 - how do I bypass a publish error?

I have a day's long publish to a website using sandcastle, and only one of the mulfiple files gets an error and halts the whole publish until the user presses no to debug and then it continues. How would I go about bypassing this error for the specific file? ...

How to make a banner code in javascript and php

Example client put this on their website <script type="text/javascript" src="http://domain.com/banner.php?bid=123&amp;affid=88"&gt;&lt;/script&gt; In my banner.php how do I implement it? I try to get the banner id & affid using $_GET but it's not working.. Let me know the clue how to display the banner on my client site using this ...