I have this code:
function beforemouseout() {
if ($(this).val() == '') {
$(this).val($(this).attr('title'));
}
else {
}
setTimeout('beforemouseout()',3000);
}
$(".other").click(function() {
$(this).val('');
$(".other").mouseout(beforemouseout);
});
<input id="hour" type="text" class="other" autocomplete="off"...
I've seen a lot of questions around here about implementing dynamic forms in jQuery or other javascript libraries, and I think I managed to get up and running in setting up a dynamic form for my test purposes.
My question is whats the best practice in naming my form fields and processing them on the server side.
I am trying to implemen...
Hi,
i use the following to to set the text content of an css element
var cell = document.createElement('li');
cell.textContent = this.labelForIndex(index);
Now i want to set the back-ground image and color.....how to do it??
...
I am currently writing my first extension for Safari 5. I can't find a reference on what events an extension can react.
I want my extension to react on these events:
when a new tab is created.
when a new browser windows is created.
when the URL inside a tab changes.
Is this possible?
...
I came across a piece of code that is:
for(i=((90.0E1,0x5A)<=(0x158,140.70E1)?(.28,3.45E2,0):(95.30E1,26.40E1)<=1.400E2?(1,this):(108.,0x227));i<length;i++) {
// some other code here
}
Can someone help me by explaining the stuff in the for() brackets?
Thanks
...
I understand why JSLint kicks up a warning here, but I don't know how else to write my code so it validates.
Here's a boiled down sample. In the code below, I have an object that I need to attach two event listeners to: one for "complete" and the other for "error". Each points to its own event handler. When either event handler is reac...
Hi, this question might be available online but sorry that I cant find a solution that I understand. Can someone pls help me?
The situation is this, I would like users' browser to cache external .css and .js files. However, each time I made changes, I would want user's browser be able to load the updated external files instead of using ...
I have a fixed width input of type text. If the user was to enter a long value into this field I would like the beginning of the value to be shown when the input no longer has focus.
Default behaviour in FF and IE leaves the view of the field value in the same state. Chrome on the other hand seems to behave as I want, it shows the beg...
Is there a php or javascript code that can detect the current user's page and then add <a class="active"> to an item in a ul (my menu). I include my menu in my pages with PHP include so making change is easy; I only have to edit it once. But, with that method, I can't individually set each page to have a class="active". How can I do t...
ok, today I'm making a helper HTML function. It looks like this:
function Input($name,$type,$lable,$value= null){
if (isset($value)) {
//if (this.value=='search') this.value = ''
echo '<label for="'. $name .'">'. $lable .'</label><input type="'.$type.'" name="'. $name .'" id="'. $name .'" value="'.$value.'" onfocus="if (this.v...
I'm confused:
function is_valid(name) {
var regexp_name = /^(\d|\w)*$/gi;
return regexp_name.test(name);
}
// Console
console.log(is_valid("Test"));
=> true
console.log(is_valid("Test"));
=> false
console.log(is_valid("Test"));
=> true
console.log(is_valid("Test"));
=> false
What am I doing wrong?
...
A clientside javascript library I've developed uses objects as hashes in some areas. It loops through objects parsed from Json data with a for...in loop using the property name as a key. eg... (pseudo code)
var conversations = {'sha1-string':{name:'foo',messages:[]}}
for(var id in conversations){
console.log(id);
console.log(c...
I have an array like this:
var gridArray = [ 1,2,0,1,2,3,2,1,2,3,4,4,3,2,2,2,0 ]
And I would like a jQuery each() function like this:
$('li.node').each(function() {
loop through the array
var rndTile = the current array digit
$(this).css({ 'background-image': 'url(images/'+...
Hi I have a hyperlink in asp.net that I want to dynamically create. I also add additional attributes like onmouseover to call a javascript function. My problem is that instead of setting my attribute to
onmouseover="myJSFunc('param')"
it converts it to
onmouseover="myJSFunc('param')".
Any ideas how to get this to work i...
I have a function:
function myfunction()
{
if (a == 'stop') // How can I stop the function here?
................
}
Is there something like exit() in javascript?
Thanks.
...
Is there a way to get the line number where the element (html tag) sits on the source?
e.g.
<html>
<head></head>
<body>
<div></div>
</body>
</html
so the <div> tag would be on line 4 in this case. Or if there is a way to get the source code using JS this would solve my problem, too.
...
I have the following code
function myFunction(items) {
// this prints out 11
alert(items.length);
$(items).each(function(i, item) {
// item is undefined for some reason
}
}
It I alert the length of items, it has elements in it (11 to be exact). so how could 11 items be present, but jQuery still pass undefined?
...
As my last question was closed for being "too vague" - here it is again, with better wording.
I have a "grid" of li's that are loaded dynamically (through JavaScript/jQuery), the Array isn't huge but seems to take forever loading.
So, SO people - my question is:
Am I being stupid or is this code taking longer than it should to execute?...
Hi
I have a pre element with some html code in it.
the code has special characters in it, like <, so it doesn't break the page.
Then I have a javascript function that gets the contents of this pre element, highlights it (with codemirror), and replaces the element contents with the highlighted text.
I'm using $("pre").append(...); t...
I just started in Adobe air html/js .
In the current application I want to do something like this .
I want to open the urls/web pages in the application and application should act like a web-browser to them .
But with that I want to modify the opened pages a little, like add some css/js to them.
Something like when you open Web pages ...