I would like to match a digit and replace it with that many spaces. Can this be done in less than 9 lines of code?
Example
"asnthsnth4nts4h3n" --> "asnthsnth nts h n"
hello friends sorry for previous question actuly my question is i am having one button called btn[0] which is allready on browser when it is loaded when i click on btn[0] it will create another button element called btn[1] now btn[0]'s click event is disabled and when i click on btn[1] it will also generate another button which called btn[2] when i click on btn[2] it will generate another btn called btn[3] and so on
The following code resets one selectOneMenu through particular id. How to make it dynamic for more selectOneMenus to reset at the top value.
var test= document.getElementById('form1:text3');
test.options.selectedIndex=0;
This resets to top value of menu, but how to make it dynamic.
ANy help is appreciated.
I'm in the process of designing this site http://www.parisgaa.org/parisgaels and have a problem.
The image slider on the homepage messes up sometimes. Most of the time it works and looks fine, but other times its positioning seems to get messed up and it appears underneath the content that should be below it (i.e. with that content overlapping the image). You should be able to replicate this in Chrome - just refresh a couple of times.
I'd appreciate any help at all.
Title says it all. I know this can be done in IE by creating an ActiveX object, but how do I do it in FF. The navigator.plugins['Adobe Acrobat'] object lets me know if it's installed or not, but it doesn't contain the version number. Any ideas?
I am doing something wrong. At the end of this o is empty. I want to pass in a string such as a=3&zz=5 and do o.a and o.zz to retrieve 3 and 5. How do i generate this object?
function MakeIntoFields_sz(sz) {
var kvLs = sz.split('&');
var o = new Array();
for (var kv in kvLs) {
var kvA = kvLs[kv].split('=');
var k = '';
var v = '';
if (kvA.length > 0) {
k = kvA[0];
if (kvA.length > 1)
v = kvA[1];
o[k] = v;
}
}
return o;
};
Hi,
I have this code, it looks alright and is really basic, but i can't make it work:
function checkValid(elem){
var abc = elem.value;
var re = "/[0-9]/";
var match = re.test(abc);
alert(match);
}
It matches 0 and 9, but not 1 to 8, what's wrong here? Thanks.
Is there a way to figure out what the top domain for the hostname of the current page is? The problem I have is that the script could be on .com domain, or in an international domain like .co.uk
So for:
jobs.telegraph.co.uk - top domain is:telegraph.co.uk
jobs.nytimes.com - top domain is nytimes.com
The problem is that location.hostname , and the document.domain give the entire domain.
One route is to have a list of all TLDs (too much to carry around) and parse based on that. Another route was if 2 characters after last ".", than internationaltion - hence last two are the TLD, but that does not hold true for all international domains.
i have a string like following:
Assigned to ram on 2010-04-22 12:30:13.0
i need to extract the third word (ram). I tried the below regex, its not working.
/\s[a-zA-Z]*\s/
any help to fix this would be greatly appreciated.
I don't want my website's user to use backspace to go to the previous page,
but I still want to keep the use of backspace,
just like deleting wrong typing.
How can I do?
Thanks a lot.
Hi,
I have some js arrays and I want to find the arrays by name. for example:
arr1 = [1,2,3];
arr2 = [3,4,5];
And access them like this:
var intNum = 2;
var arrName = 'arr' + intNum;
arrName[0]; // equals 3
Is this possible?
Thanks,
Kevin
I need to access to a value in a checkbox, the atribute value has content, so i need to place the id somewhere else i created a label, but i have not access to that value
alert(check[i].label); // doesnt work
where else can i place a value in checkbox.
Please dont write that i can do this
<input type='checkbox' id='bla' name='mybla' vlaue='myvalue'> Hy
Where can i place some other values ?
I tryed with this
<input type='checkbox' id='bla' name='mybla' vlaue='myvalue' label='myothervalue'> Hy
first i get all checkbox ect... and in the for loop i did this
alert(check[i].label); // doesnt work
How can i do that?
I've come across this.inheritFrom that enables you to inherit from a super class.
var superClass = function() {
this.foo = 'foo';
this.bar = 'bar';
}
var subClass = function() {
this.inheritFrom = superClass;
this.inheritFrom();
this.myFunction = function() {
return this.foo;
};
}
I've looked in Mozilla and MSDN, but I can't seem to find it documented any where. As far as I can see it works in IE6 and Firefox 3. Any reason why it wouldn't be documented?
I'm having a bit of an issue with me code. I'm trying to do a calculation from a drop down menu and then it will onChange to a textbox. I've been at it for days trying to figure it out and Googling ways to code the function. Can anyone please help or give me advice on how to approach this?
function numGuest()
{
var a = document.getElementById("guests");
if(a.options[a.selectedIndex].value == "0")
{
registration.banq.value = "0";
}
else if(a.options[a.selectedIndex].value == "1")
{
registration.banq.value = "30";
}
}
<select id="guests" name="guests">
<option value="0">0</option>
<option value="1">1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
<input type="text" id="banq" name="banq" onChange="numGuest()" disabled />
hello friends sorry for previous question actuly my question is i am having one button called btn[0] which is allready on browser when it is loaded when i click on btn[0] it will create another button element called btn[1] now btn[0]'s click event is disabled and when i click on btn[1] it will also generate another button which called btn[2] when i click on btn[2] it will generate another btn called btn[3] and so on
Hi
I need to know if it is possible the current execution node? Ej:
..html
<script id="x"> //
console.log(document.currentNode.id); // << this must return "x"
</script>
..html
thanx
Hello!
I am creating a small yatzy game and i have run into some regex problems. I need to verify certain criteria to see if they are met. The fields one to six is very straight forward the problem comes after that. Like trying to create a regex that matches the ladder. The Straight should contain one of the following characters 1-5. It must contain one of each to pass but i can't figure out how to check for it. I was thinking /1{1}2{1}3{1}4{1}5{1}/g; but that only matches if they come in order. How can i check if they don't come in the correct order?
I need to create a form element
<input disabled type="text" value="smth" />
which is disabled by default. It enables when onmouseover occures.
onmouseover="this.disabled=false;"
And is disabled by onmouseout
onmouseout="this.disabled=true;"
What I need is to check the following.
If the <input> is focused then it shouldn't be disabled.
And if the form element loses focus it disables.
Please help me to complete the events.
<input disabled type="text" value="smth" onmouseover="this.disabled=false;" onfocus="???" onblur="???" onmouseout="if(???){this.disabled=true;}" />
HI volks,
I try to set some hidden form field values with an onclick event.
Ok, after I did something like this:
document.getElementById('hidden_field').value = 123;
I can output the value with the firebug console by entering this:
alert(document.getElementById('hidden_field').value);
So the values are definitely set. But now when I submit the form, the hidden field values are still empty.
Do you have any idea whats going wrong?
Thx for your answers.
I want to create an alert box with 3 radio buttons in it. It should be like
'Replace'
'Save'
'Merge'
along with OK and Cancel buttons. Any idea how to achieve this?
I have a function acting as a constructor that, when called, gets as far as the function definition in the debugger, but never to the function body. Is there a common reason this may happen that I am overlooking? Example code below:
myconstructor.js
function MyConstructor(optionalParam) { //this breakpoint gets hit
var newobj = {}; //breakpoint never hit
//code to check for null parameter
//other code
};
main.js
var myConstructor = new MyConstructor();
There must be something I have overlooked, but I can't see what that is. Neither firefox/firebug nor VS report errors or warnings.
Thanks!