javascript

Javascript Alert in META tag

Is there any way to work an alert to run when I echo a META tag which is refreshing the page? The goal is to have the page refresh and then the Alert loads. Example of current line: echo '<META HTTP-EQUIV="Refresh" Content="0"; URL="contact-test.php">'; ...

Firefox and Chrome give different values for offsetTop

I am trying to position an span element (let us call it "the tooltip span") relative to a input field. To do this, I am wrapping the tooltip span and the input field in another span element (let's call it "the wrapper span") that has position: relative. Then I set position: absolute on tooltip span. This makes the tooltip span position i...

Net DateTime.AddMonths(1) doesn't work the same as Javascript d.setMonth(d.getMonth() + 1)

I have client side date validation that requires one particular Date to be one month from a different date so I use d.setMonth(d.getMonth() + 1) and mostly works just fine. For end of month issues as in 1/31/2009, it returns 3/3/2009 and that's great - that's how I'd prefer it handle it. In the code behind, I'm also generating this d...

Read & display text file in javascript

The user needs to click on browse button to browse his system .He then selects a text file & clicks ok.Once he clicks ok all the data in the text file should be displayed in a text area.How do I do that? I am using JavaScript & c# designing aspx pages.It would be preferable if i avoid round trip to the server. ...

JSON parsing with JsonResult and JavaScript

Environment: ASP.net MVC: Given anonymous structure as such: var test = new { name = "me", age = "100" }; that then gets parsed as result = Json(test) data = result.Data // Comes back with { name = "me", age = "100" } Which then gets successfully passed into a JS function, how do I go about using that as a JSON object, s...

Autofill in the Gridview --> Itemtemplate --> Text Box or Dropdown

Hi, I have a following requirement. ASP.net GridView control has following fields. HeaderTemplate ID ------ Name---------- Model dropdown[ ALL-Yes ] --------Description. Item template label------ label ----------Dropdown ------------------------- Text box ID and Name field bound to datasource and populated from databas...

Basic jQuery question: How to change iframe src by clicking a link?

I have an iframe that looks like this: <iframe src="http://www.google.com" height=1000 width="500" id="myiframe"></iframe> I want to create a link so that when I click on it, the iframe on the page changes. How can I do that using jquery? Is it related to jquery attr? Thanks! ...

Why is document.getelementbyId not working in Firefox?

I can't figure out why document.getElementById is not working in Firefox: document.getElementById("main").style.width = "100"; When I check in Firebug it says: TypeError: document.getElementById("main") is null Does anybody know why this is happening? EDIT: Unfortunately, the "body" element was a bad example. I changed it to anothe...

Need to find height of hidden div on page (set to display:none).

I need to measure the offsetHeight of a div that is inside of a hidden element. <div id="parent" style="display: none;"> <div id="child">Lorem Ipsum dolor sit amet.</div> </div> The parent div must be set to "display:none". I have no control over that. I realize that the offsetHeight of the child div is going to be 0. I need to fi...

What do { and } mean inside params?

Take the example: $.ajax({lhs:val}); What does the {} do? As far as I know, there's no named parameters -- so is this an actual member (same as $.ajax.lhs)? What does it mean and what does it do? ...

JQuery Scrolling/Paging Tabs

I am trying to create a simple tab bar for a site that has the ability to scroll for tabs that do not fit on the page. This is quite simple and does not need to have any ajax or dynamically loaded content...it simply displays all the tabs, and when you click one, it takes you to another page. I have scoured the internet and can not seem...

is postMessage JSON encoded/decoded in Google Chrome as it is in Firefox?

I know its part of the HTML5 spec, but sometimes WebKit doesn't conform to the latest draft of the spec. ...

How to do multiple regular expressions, each time refining the results?

Why can't I output my regex to a variable, and then run regex on it a second time? I'm writing a greasemonkey javascript that grabs some raw data, runs some regex on it, then runs some more regex on it to refine the results: // I tried this on :: http://stackoverflow.com/ var tagsraw = (document.getElementById("subheader").innerHTML)...

break-on-modify in firebug?

I'm having trouble tracking down a bug which is causing a button to get disabled. Is there a way to have firebug break if the button state is touched in javascript? ...

Easy way to quick select a whole optgroup in select box

I have a select box in which i can select multiple options. In the select box are multiple optgroups. Is there an easy way to select a whole optgroup at once in javascript? ...

onSubmit not triggered on form loaded with AJAX

Hi, I use AJAX to load an external HTML file, containing a form, into another HTML file. The form HTML looks something like this: <form id="..." name="..." onsubmit="postUsingAJAX(x,y,x); return false;"> Loading works fine. However, the onSubmit code is not executed when the form is submitted, same thing with onClick handlers on the s...

What does this mean: "document.write('<scr'+'ipt... "?

I've seen this on every Yahoo! news page, at the bottom of the source code, and failed to understand why they break the script word like that. Does anybody know if there's any reason for this? document.write("<scr"+"ipt language=javascript src=http://l.yimg.com/d/lib/bc/bc_2.0.4.js&gt;&lt;/scr"+"ipt&gt;"); ...

Watin tutorial execution returns a Javascript error on IE for every "keystroke"

I am using Watin for the first time, setup the tutorial, but as soon as i hit run, watin opens up IE and starts "typing" for WatiN on the Google search box, but the problem is, every keystroke, returns a javascript error getElementById not found error... Anyone had this problem ? I am running on Windows Vista 64 with VS 2008 (havent...

Does jQuery do any initial processing?

Simple question. If you include jQuery in a page of HTML, is there any initialization overhead before one uses any jQuery functions. ...

Preventing spamming of the functionality of a php page.

The background: Ok, I run a legacy BBG over at ninjawars.net. There is an "attack" that players can make on other players that is initialized via form post. Essentially, we can simplify the situation to pretend that there's a page, lets call it attack.php, with a giant "ATTACK" form post that submits to another php page, lets call it a...