javascript

How to change form element values in HTML

Hi Guys, I have this piece of simple code. <html> <head> <script type="text/javascript"> function changeText() { var form = document.forms['detail']; form.desc.value="success"; } </script> </head> <body> <form name="detail"> <input type="text" name="desc" id="desc" > <input type="submit" value="c...

How to prevent embedding my web page inside an iframe?

Possible Duplicate: How to prevent my site page to be loaded via 3rd party site frame of iFrame How can I prevent others from embedding my web page inside an iframe? ...

Display form field based on selection

Hi guys, I need to make a form that can display certain form inputs when another selection is selected, for example if I select gender: male, input form "blue" displays, and when gender:female input form "pink" displays. I am assuming that Javascript/jQuery would be the best bet? This is what I have thus far: function showHideSchoo...

jQuery slidebar for searchbox?

Hi all, I'm currently working on a search box for my site that will hopefully use a slide-bar instead of tabs to conduct the search. Users will enter a search query and instead of choosing from the conventional tabs above the box, they will have the option to search based on the position of the slider (ie. a "stronger" or "weaker" range...

Extracting an array of integers using a regular expression in javascript

I'm having real difficulty with this but I'm no javascript expert. All I want to do is get myself an array of all matches in a string which match a given regExp. The regExp being this : [0-9]+ ie. Any integer. So If I pass the string "12 09:8:76:::54 12" I should get arr[0]="12" arr[1]="09" arr[2]="8" arr[3]="76" arr[4]="54" arr[5...

Evaluate string as Object without eval() dynamically?

EDIT: Thanks Kenny and everyone else who answered similarly. It really was a DOH...So stupid of me not to remember this. Maybe the answer is so simple it's eluding me...but I know someone here can school me on this hopefully. So I've got a rather large project that's dealing with tons of very large JSON, Objects, Arrays, etc..And I ne...

Checking the form field values before submitting that page.

Hi I have written following function which checks whether start_date field is not empty and displays proper message when submit button is clicked. But then it takes the control to the previous page. So user has to write again all other fields on that form. Is there any way to stay on that page even after prompting the error message, wit...

global custom events in jQuery

I want to use custom jQuery events independent of DOM elements, but I'm not sure what the best way is to achieve this. Here's what I started out with: // some system component registers an event handler $().bind("foo.bar", handler); // foo is my app's namespace, bar is event name // another part of the system fires off the event $().tr...

How to know where javascript method is defined and which method is called using firebug

How can we know which javascript method is called and where it is defined? (When methods are attached dynamically) Let us consider situation where JQuery Bind method is used to bind an event. If I see control in FireBug with FireQuery, I can see events=Object{click =} handle=function() But I don't know which method is attached with click...

Resizing iframe? - Webkit or Firefox

Hi folks, is it possible the proportions within an iframe? e.g. 100%, 50%, 25%, ... I would like to implement a "magnifying glass" for a webpage or iframe. It does not have to be implemented in Javascript within a website, but even a desktop solution would be great. Is this a possibility? or would it be incredibly complicated? Any ...

Can't access form element in IE because it 'is undefined'. Works ok in FF and Chrome

It's strange because I only get 1 error in IE: 'sTime is undefined'. sTime is the ID of one of the many input elements in my form. Everything works fine in Chrome and FF. Here's a link to the code: http://la.truxmap.com/sched.html and the form html: <form id="addNewTruck" class='updateschedule' action="javascript:sub(sTime.value, e...

Great animation engines for Javascript? - Javascript/Animations

Hi folks, I'm trying to implement a timeline based animation, where animations will be able to be: paused resumed fast forwarded slowed down reversed ... Are there any animation/tweening engines for Javascript that could be used for such purpose? Or that would be highly recommended? Hwlp would be great, especially as this really ...

How to add news in ticker ?

Hi Actually my code is- <html> <head> <script type="text/javascript"> var sText = "" var i=0 var iNews=0 var rss = new ActiveXObject("Microsoft.XMLDOM") rss.async = false rss.load("http://rss.news.yahoo.com/rss/world") function GetNewsSource(){ var itemNodes = rss.selectNodes("/rss/channel/item") var iMax = itemNodes.length sText = it...

How to Call simple WCF service using jquery or simple js

I have a very simple hello world WCF service as given below. When i call it via asp.net project by adding web service reference it works perfectly fine. But when i called it using JQury or standard js ajax call (using XMLHttpRequest) it calls back the success function but returns null data. When i tried to access it via firefox browser ...

IE8 inserting text to textarea problem

I have some code to insert tags to textarea (for Internet Explorer). But I have problem with IE8. If there is lots of text and I try to insert text somewhere in the end - it's scrolled up. Code: <script type="text/javascript"> function bold() { var text1 = document.getElementById('text1'); var sel = ''; if (document.select...

Node.js run script

Hi all, I have Apache httpd server and node.js. I need to emulate real JSON data which changes every time. I found, that I can run node.js as server in standalone mode like this: var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).list...

get week of month using javascript / jquery

How can i get the week number of month using javascript / jquery? For ex.: First Week: 5th July, 2010. / Week Number = First monday Previous Week: 12th July, 2010. / Week Number = Second monday Current Date: 19th July, 2010. / Week Number = Third Monday Next week: 26th July, 2010. / Week Number = Last monday ...

Googlemap highlighing specific country on map.

Hello, Is there a way to draw lines around the countries and onmouseover changing the background-color of that country on map. Thanks. ...

Scrollable menu in JavaScript

Hi, I am trying to create a scrollable menu list in JavaScript and I am following a tutorial http://javascript.internet.com/navigation/menu-scroll.html But nothing appears on my page. This is what I have tried: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; <html> <hea...

I want to apply javascript and CSS to all browser but not to IE6 is it possible?

I want to apply javascript and CSS to all browser but not to IE6 is it possible? for example I have a javascript abc.js I want to use this javascript in all browser IE7, IE8, IE9, Firefox, Safari, Chrome. But i don't want to use this javascript in IE6. ...