I have this piece of code:
var myObj = function () {
this.complex = function (text) { /* long piece of code */ }
this.parse(text) {
...
|
I got a string like:
settings.functionName + '(' + t.parentNode.id + ')';
that I want to translate into a function call like so:
clickedOnItem(IdofParent);
This of course will have to be done in javascript. ... |
Say I've got a Javascript string like the following
var fnStr = "function(){blah1;blah2;blah3; }" ;
(This may be from an expression the user has typed in, duly sanitized, or it may be the ... |
I'm trying to do a plugin for firefox in XUL language.
So I got informations in json, I parsed them and I can use the title in javascript.
But I would use it ... |
I need a short basename function (one-liner ?) for Javascript:
basename("/a/folder/file.a.ext") -> "file.a"
basename("/a/folder/file.ext") -> "file"
basename("/a/folder/file") -> "file"
That should strip the path and any extension.
Update:
For dot at the beginning would be nice to ... |
I have the following filepath
var imagepath="C:\Documents and Settings\Mahesh\Desktop\images\advts.png"
how can i replace \ with \ so so that it prints
var imagepath="C:\\Documents and Settings\\Mahesh\\Desktop\\images\\advts.png"
|
I'm using both javascript/vbscript in my HTA and am building the table for my HTA interface inside of a VBS loop. When I simply run:
strHTML = strHTML & "<tr>" &_ ...
|
|
Before I go and create this myself, I thought I'd see if anyone knows a library that does this.
I'm looking for a function that will take something in Javascript, be it ... |
Could someone help me understand why new Function does not work here?
var fn = data["callback"]; // String with value: function() { anotherFunctionToRun(); }
var foo = new Function("return ("+fn+")");
foo();
alert(foo) // returns function ...
|
I have a function:
var greet = function (name) {
console.log("Hi " + name);
}
If I have a string "greet('eric')" is it possible to convert it to a function call ... |
How to load a javascript function via string
<div id="test_div">display here</div> // < --display here
<script type="text/javascript">
// string
var _script=("<script type=\"text/javascript\">
var disqus_shortname = 'example';
(function ...
|
I have an xml file with words and definitions.
<word definition="this is my definition">myWord</word>
When my html page has myWord, I want to change myWord into a link with its title holds ... |
I have strings like this:
abcdefg
abcde
abc
jjjj
I need is them trucated to show like this if more than a specified lenght:
abc ..
abc ..
abc
jjj ..
Is there any simple javascript code I can use for ... |
I have a select (dropdown list) with options which correspond to actions. Each action corresponds to a generic javascript function that should be called on the changed event for the ... |
For example;
var s = "function test(){
alert(1);
}";
var fnc = aMethod(s);
If this is the string, I want a function that's called fnc. And fnc(); pops alert screen.
eval("alert(1);") doesnt solve my problem.
... |
Wanna know how come the error only appears in IE
Can it work by modifying?
3q.
Function
input: 192.2.09.001
output: 192.2.9.1
ERROR@IE
input: 192.2.09.001
output: undefinedundefinedundefined.undefined.undefinedundefined.undefinedundefinedundefined
Code:
ip_normalize(ip)
function remove_0(input)
{
var i;
var output_string="";
...
|
I have a function that searches through an array of strings. It works perfectly, except for the fact that its case sensitive. I need it to be case insensitive.
The easiest ... |
I've done a bit of googling round but this particular problem is a little too similar to the "how do i evaluate function names from strings" so I'm having trouble finding ... |
\b means "word boundary" so it matches any non-word character. But it also matches the beginning and end of the text, so it's better than using \W. /g means "global". In this case, do a GLOBAL replace of all occurences of the match string within the the given text. If you omit the g, then only the first occurrence will be ... |
|
Thanks rwedge, your code works exactly as what I wanted but what's wrong with the code I cited in my post? Why doesn't it work? Thanks to Aerospace too for his suggestion but sorry to say, Aerospace, I am not fully convinced with your statement that I should be doing this server-side rather than client-side. I feel when & where one ... |
|
|
|
|
|
Code: function addit(rectype) { thisdiv = "Clone" + rectype; anchordiv = "Anchor" + rectype; initrecs = initrecs + 1; var ocfunc = "removeit('recdiv" + initrecs + "','delflag" + initrecs + "');" var newNodes = document.getElementById(thisdiv).cloneNode(true) newNodes.id = "recdiv" + initrecs; newNodes.style.display = 'block' var newNode = newNodes.childNodes; for (var i=0;i |
|