Hello All
I am using javascript associative array like:
var testarray = [];
testarray['one'] = '1';
testarray['two'] = '2';
testarray['three'] = '3';
I am also using jquery alongside. How can I check length of this associative array using jquery or any other method? Basically i want to check whether this array is empty or not.
Thank you.
Anyone know a way to obfuscate javascript before it's outputted to the browser? I was using
http://www.javascriptobfuscator.com/
But I'm hoping there is a library that can do this on the fly.
Help appreciated.
I use the below code to write code to query a web method in a specified interval.
now in the this.Poll function I have to do
this.tmo = setTimeout(this.strInstanceName + ".Poll()", this.iInterval);
instead of
this.tmo = setTimeout(this.Poll(), this.iInterval);
because IE looses the this object after setTimeout
So I have to pass the class it's instance name:
var objPoll = new cPoll("objPoll");
How can I get the instance name without passing it as parameter ?
I want to have it outta there !
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Intervall-Test</title>
<script type="text/javascript" language="javascript">
function test()
{
alert("Test");
test.tmo = setTimeout(test, 2000);
test.Clear = function()
{
clearTimeout(test.tmo);
}
}
function cPoll(strInstanceName)
{
this.strInstanceName = strInstanceName ;
this.iInterval = 2000;
this.tmo=null;
this.cbFunction=null;
alert(this.Name );
this.Poll = function()
{
this.cbFunction();
this.tmo = setTimeout(this.strInstanceName + ".Poll()", this.iInterval);
}
this.Start = function(pCallBackFunction, iIntervalParameter)
{
if(this.tmo != null)
this.Stop();
if(iIntervalParameter && iIntervalParameter > 0)
this.iInterval=iIntervalParameter;
this.cbFunction=pCallBackFunction;
if(this.cbFunction!=null)
this.Poll();
else
alert("Invalid or no callback function specified");
}
this.Stop = function()
{
if(this.tmo != null)
{
clearTimeout(this.tmo);
this.tmo=null;
}
}
}
function CallBackFunction()
{
alert("PollCallBack");
}
// test();
// test.Clear();
var objPoll = new cPoll("objPoll");
</script>
</head>
<body>
<h1>Test</h1>
<input type="Button" value="Start polling" onclick="objPoll.Start(CallBackFunction,3000);" />
<input type="Button" value="Stop polling" onclick="objPoll.Stop();" />
</body>
</html>
In javascript, If i have a text block like so
Line 1
Line 2
Line 3
What would i need to do to lets say delete the first line and turn it into:
Line 2
Line 3
How can i get current x & y position of my CURSOR within a text area using javascript.
The event is a Keyup event, not a mouse event.
I am not looking for the current cursor position in terms of charecter but x , y coordinates.
Hi,
Does anyone know of a javascript UML diagrammer?
I have found the Eclipse plugin jsuml from jsuml.org, however the plugin crashes when I try to generate a diagram.
Thanks,
Bob
I have JSF code like:
<h:inputText id="from" value="#{fromToMBean.fromName}"/>
I would like to get this element from JavaScript by ID (from), but I can't, because in generated HTML it is j_idt8:from
How can I get this element in e.g. jQuery? Is there any way to force JSF2 not to change ids?
Hello!
How do I load photoshop's action using its javascript scripting language?
Mostly curious in this action steps:
Add Noise
Distribution: gaussian
Percent: 2%
With Monochromatic
Texturizer
Texture Type: Canvas
Scaling: 100
Relief: 3
Without Invert Texture
Light Direction: Top Left
I'm currently using Visual Studio 2008 to edit .js files with, and it has decent support but I want more...
I like the VS syntax highlighting and auto-indentation features but additionally would like advanced features like: contextual info and help, collapsible JavaScript blocks, implicit symbol understanding for searching, refactoring and that kind of thing; also warnings and errors for the js code.
Suggestions?
There is showdown.js to convert markdown to HTML, and PHP Markdown to convert markdown to and from HTML. My question is, is there javascript library to convert HTML to markdown?
Firebug is certainly a wonderful tool for javascript debugging; I use console.log() extensively.
I wanted to know if I can leave the Firebug-specific code in production.
What's the best practice? Commenting the debug code?
I need parse a string inside a parenthesis, which looks like (A, B, C), where A, B, and C are string that can contain any legal JavaScript code. For example, B might be a very long string with nested structures similar to (A, B, C). What would be the best way to parse such a string?
Hello guys,
I am currently using the below IDE's. They serve their purposes but am wondering if there are better ones out there that i can switch to.
phpDesigner v6.2.5 (For PHP)
Navicat 8.0.29 (For MySql)
Dreamweaver CS3 (For HTML & CSS)
Spket IDE (For JavaScript)
Thats my collection of production tools. Wondering if there is anyone of them i can switch to a better one.
Thanks
I've just updated to the AJAX Control Toolkit 3.5, changed the ScriptManager to the ToolkitScriptManager in my master page and now the following javascript error occurs when an Edit button is clicked:
"Object doesn't support this property or method"
The line of code cuasing the error is:
this._destroyTree(updatePanelElement);
Any initial ideas before I post masses of code?
I'm part of a testing team and have been tasked with "behaving badly" using javascript in a firefox browser. I've tried these methods to take the browser down http://www.yuki-onna.co.uk/browserdeath.html but none of them do anything worse than cause a popup asking to shut down the script.
Any other ideas?
How can I check if an anonymous object that was created as such:
var myObj = {
prop1: 'no',
prop2: function () { return false; }
}
does indeed have a prop2 defined?
prop2 will always be defined as a function, but for some objects it is not required and will not be defined.
I tried what was suggested here: http://stackoverflow.com/questions/595766/how-to-determine-if-native-javascript-object-has-a-property-method but I don't think it works for anonymous objects .
Hi I have this code which working on fitrefox but not working on IE missing last charector on IE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>wrapped</title>
<script type="text/javascript" language="javascript">
function set_padd(){
var tt = document.getElementById("span_padding").innerHTML;
var txt = new Array();
txt = tt.split(" ");
var atxt = '';
var f_txt = '';
var wrd_pr_linr = 4;
var cnt = 1;
for(var i = 0; i < txt.length; i++){
if(txt[i].length > 0){
txt[i] = txt[i].replace(' ','');
if(cnt < wrd_pr_linr){
if(txt[i].length > 0){
atxt += ' '+txt[i].replace(' ','');
cnt++;
}
}else{
f_txt += '<a class="padd_txt" >'+atxt+'</a><br />';
atxt = '';
cnt = 1;
}
}
}
document.getElementById("span_padding").innerHTML = f_txt;
}
</script>
<style type="text/css">
.padd_txt{padding:7px;background:#009;color:#FFF;line-height:26px;font-size:14px;}
body{font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; font-size:24px; line-height:1.2em;}
span{background-color: #009; width:200px; color: #FFF;" class="blocktext;}
</style>
</head>
<body onload="set_padd();">
<div style="width: 350px;">
<p>
<span id="span_padding">
This is what I want to
happen where one
long string is wrapped
and the text has this
highlight color behind
it.
</span>
</div>
</body>
</html>
out put on firefox is
This is
I want to
happen where one
string is wrapped
and the text
this highlight
behind it.
and output on IE
This is what
want to happen
one long string
wrapped and the
has this highlight
missing last two word
Please can anyone translate this python code into javascript.
#
def strip_punctuation(s):
#
for c in ',.":;!%$':
#
while s.find(c) is not -1:
#
s.replace(c, '')
Hi, I want to write a web crawler that can interpret JavaScript. Basically its a program in Java or PHP that takes a URL as input and outputs the DOM tree which is similar to the output in Firebug HTML window. The best example is Kayak.com where you can not see the resulting DOM displayed on the browser when you 'view source' but can save the resulting HTML though firebug.
Is there any way with jQuery or javascript to trigger a function when the user ends to resize the browser window ?
In other terms:
1) Can I detect mouse up event when user is resizing the browser window ?
otherwise
2) Can I detect when a window resize operation is finished ?
I'm currently only able to trigger an event when the user start to resize the window with jquery
thanks
I am looking for a way to insert javascript code block to end of ASP.NET page.
Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "showVideo", sScript, true);
is appending to body but js codes are always requesting some js files didn't load or some functions are below of the script.
How can i append scripts that i generated dynamically to the bottom of body?
Thanks for your help.
Greetings,
how can I inject c# code (my Model property) inside javascript? I want to do something like this:
$(".star<%=Model.ROWGUID %>").mouseover(function() {
var span = $(this).parent("span");
var newRating = $(this).attr("value");
setRating(span, newRating);
});