javascript

document.getElementById doesnt work with "input id", how can I do it? [+Greasemonkey]

I have this line on a website <input type="text" autocomplete="off" value="" maxlength="20" class="shipBox" name="firstName" id="firstName"> and I want my greasemonkey to automatically fill this... I'm trying this but had no success document.getElementById("firstName").setAttribute("autocomplete", "on"); document.getElementById("fi...

Print content of a javascript tabcontrol: Gridviews

I've got a JQuery tabcontrol (4 tabs), which each of them control 1 gridview. now I got a button "print". It activates a javascriptfunction, which should build a page, containing all gridviews. I got something, but it does not work: function doPrintPage() { myWindow = window.open('', '', 'titlebar=yes,menubar=yes,status=yes,scr...

How to discover Font Type?

Is there a way to determine the type of a given font (TrueType, OpenType, Type 1, Bitmap) using javascript? ...

How can I separate words in td with an html tag?

How can I use jQuery to separate multiple words in a td with an HTML tag such as <br/>? For example, <td>hello bye</td> would become <td>hello <br/> bye</td>. ...

jQuery selector loads images from server

Hi! here is the code: <script type="text/javascript"> var ajax_data = '<ul id="b-cmu-rgt-list-videos"><li><a href="{video.url}" '+ 'title="{video.title.strip}"><img src="{video.image}" '+ 'alt="{video.title.strip}" /><span>{video.title}</span></a></li></ul>'; var my_img = $(ajax_data).find('img'); </scr...

RegEx - Time Validation ((h)h:mm)

/^\d{1,2}[:][0-5][0-9]$/ is what I have. this limits minutes to 00-59. It does not, however, limit hours to between 0 and 12. For similarity and uniformity I would like to do this with RegEx alone if possible. Further-more I would like the first digit to be optional. i.e. 09:30 accepted as well as 9:30. I played around with ranges, bu...

If you delete a DOM element, do any events that started with that element continue to bubble?

What behavior should I expect if I delete a DOM element that was used to start an event bubble, or whose child started the event bubble - will it continue to bubble if the element is removed? For example - lets say you have a table, and want to detect click events on the table cells. Another piece of JS has executed an AJAX request tha...

using the window object for accessing global user defined objects and using text within html for creating additional specificity

I don't do very much jquery / javascript but wanted to ask for some advice on the following piece. I have tried to cut out as much as possible. Most of this was semi-inherited code with catching a bunch of events just hardcoded in. I'd like to generalized them more by putting the object name in the html and accessing via jquery on proces...

Make input field background image disappear after text is inputted

I'd like to make the background image for my input field disappear once the user has typed any amount of text in it. Is there a simple way to do that in javascript? I can get it so the bg disappears while the field is focused, but then it returns once they move on to the next field. HTML: Call me at <input name="phone" type="text" ...

How to customize /#/ in Jquery address plugin

Hi, I'm using the Jquery plugin Address to achieve deep linking. The generated urls come out in the format www.example.com/#/tab/image, but what I need is www.example.com/#tab/image. The plugin seems to automatically generate the /#/ part. I wonder does anyone know how to do this? Or even if it's possible? I would greatly appreciate...

How to solve JavaScript origin problem with an application and static file server

In a system that I'm building I want to serve Static files (static HTML pages and a lot of images), and Dynamic XML generated by my servlet. The dynamic XML is generated from my database (through Hibernate) and I use Restlets to serve it in response to API calls. I want to create a static file server (e.g. Apache) so that this does n...

Howcome I cannot make my javascript 'executable' in an address bar

The second link does not work like the first one. How come? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Dynamic CSS Properties</title> <script language="JavaScript"> function change(){ //document.getElementById("box1").style.visibility = "visible"; var spanArray = document....

JQuery Date() Function Not Working

Anyone know why this doesn't work? var lastReceivedBeginDate = new Date($("input[name='lastReceivedFromYear']").val(),$("input[name='lastReceivedFromMonth']").val(),$("input[name='lastReceivedFromDay']").val(),$("input[name='lastReceivedFromHour']").val(),$("input[name='lastReceivedFromMinute']").val(),$("input[name='lastReceivedFromSe...

How does one get about making a dynamic web badge using client side javascript?

For example we want to be able to give our vendors javascript code and once embedded, it would show a badge on their site and show how long they have been doing business with us. Thank You ...

CodeIgniter Form Validaton + JS. Form re-population.

Hello. I have a from with a checkbox, and depending on the checkbox state 2 different divs are shown. var alias = document.getElementById('alias'); var list = document.getElementById('list'); if(document.getElementById('isList').checked) { alias.style.display = 'none'; ...

javascript funtion to catch return value

hi, I have a funtion like this <script type="text/javascript"> function result() { return "string"; } </script> I need to get this string value in to var var gotresult= ???? how to get here that result value ...

What's the scope of a Javascript variable declared in a for() loop?

Check out the following snippet of HTML/Javascript code: <html> <head> <script type="text/javascript"> var alerts = []; for(var i = 0; i < 3; i++) { alerts.push(function() { document.write(i + ', '); }); } for (var j = 0; j < 3; j++) { (alerts[j])(); } for (var i = 0; i < 3; i++) { (alerts[i])(); } </script> </head><body><...

Facebook's sharer.php - default view

I'm using sharer.php to share an item to the user's wall. The facebook sharer has 2 views: Post to profile (default view) : And when you click on "send as a Message instead you get : What I'm trying to do is to have the 2nd view (send a message) as the default one. So when the user clicks 'Share this', it would show him directly ...

How can I run a JavaScript function every time an HTML element is resized?

I need to run a script every time a table is resized (whenever the user resizes the browser window). Does anyone know how this can be done? ...

Append to a webpage in javascript

What I want to do is that: a webpage with continuously updating content. (In my case is updating every 2s) New content is appended to the old one instead of overwriting. Here is the code I have: var msg_list = new Array( "<message>Hello, Clare</message>", "<message>Hello,Lily</message>", "<message>Hello, Kevin</message>", "<mes...