Syntax -0 At End Of Replace()
Nov 13, 2006
I found this in one of my old scripts but I can't remember what the -0 was used for. I remember it was a shortcut method but I can't remember for what. Does this ring a bell with anyone?
var Pattern = /px/;
var T = paddingArry[0].replace(Pattern, "")-0;
View 5 Replies
ADVERTISEMENT
Jun 6, 2010
i'm a newbie on jquery i'm studying it with the latest version, and following a book called "Learning Jquery" but iencountered a error, and i don't know what the problem is:
i copied the code from the book like this:$('a[@href^="mailto:"]').addClass('mailto'); to try to change the links which start with "mailto" to the new class "mailto" but there's a error reported: uncaught exception: Syntax error, unrecognized expression: [@href^="mailto:"]
View 5 Replies
View Related
Jul 27, 2010
Here is my code:
<script type="text/javascript">
var str="Welcome to Microsoft! Microsoft Microsoft";
var stringToBeFound = 'Microsoft'
var ReplaceString = 'site'
document.write(str.replace(stringToBeFound , ReplaceString ));
</script>
My problem is im trying to use string.replace that is not case sensitive and replace every string found. I could use regular expression with it but my stringToBeFound is a dynamic variable im getting it from my database
View 9 Replies
View Related
Dec 20, 2009
i am trying to make an online graphing calculator with javascript. dont ask how because i dont know. but there is an annoying error in a do...while loop. although it should break out of the loop when the |'s (absolute value signs) are replaced with Math.abs( and ). here is the code.
var initec = function(){
var rg = {
}
[code]....
View 9 Replies
View Related
Jul 20, 2005
I am trying to order a laptop from the Dell online shop but
everytime I try to press 'continue' after picking the options, I get
an error message in the lower left hand corner of the browser.
I'm using WIN 98SE with java enabled on my laptop.
The error log says:
Line: 1
Char: 1
error: object expected
code: 0
And this is the line which pops up when I place the cursor on the
'continue' button causing the above error:
javascript:next_page(Ƈ','c=us&cs=19&kc=6V602&l=en&oc=5100FS&s=dhs');
I would assume there's a bug in that line. Although there's little I
can do about it other than forward it to the Dell folks - my pgming
background has me curious as to what's causing this!
View 8 Replies
View Related
Jul 23, 2005
onClick="javascript:myFunction()"
or does it HAVE to be
onClick:"myFunction()"
I know 'javascript' is not necessary here, but just want to know whether to include it (which sometimes I do by mistake) is incorrect syntax or not..
View 1 Replies
View Related
Aug 12, 2005
I have this JavaScript that is supposed to show random products from my
database, and show something different every time you refresh or revisit.
But I keep getting an error - on my computer - that says Syntax Error in
Line 2.
There is no error on most other computers, and the products show, but
another script on the page, an article title scroller, stops - on most
computers, but not all. It says "no articles available".
I've tried the script on an asp page and a htm page, all by itself, but it
still doesn't work. I tried changing all kinds of settings in my browsers,
but nothing helps. I'm on XP, SP2, which I've heard has some problems
handling javascripts. I don't know if that's true, but if it is, I know that
lots of other people will have the same problem as me when they view the
page. Actually, I think it is a good thing, that my computer is pointing out
this error. I get the error message in IE6, but in NS8 and FF, I just don't
see the products. No error message.
Anyway, here are the first three lines of the script:
<%
if TRIM(request.servervariables("http_referer")) = "" then
%>
Using spellcheck, I found that referer is spelled wrong, it should be
referrer. I don't know if that is right for javascript (or asp?), but
correcting it didn't make a difference.
The script is JavaScript on an asp page, and it is called in an htm page.
Is the error obvious from the 3 lines?
View 8 Replies
View Related
Sep 12, 2005
How does one center text in an alert box? and how do you make the alert box
appear in the middle of the screen? I've seen it done, but my alerts have
text left justified, and the box is longer than i need.
View 1 Replies
View Related
Jul 20, 2005
Does the "semicolon insertion" really affect you if you format code as
function x (y)
{
// ...
}
instead of:
function x (y) {
// ...
}
The jslint page complains about lines ending in ) due to the nebulous
idea of "semicolon insertion". I have not reviewed the ECMAScript pdf
in great detail to try to pin this pretty-printing issue down. In
general, I find that code formatted in the "K&R" style (opening brace
on same line as if, while, function) confusing and difficult to read
compared with placing curly braces on separate lines.
On another subject, the difference between inner functions defined
explicitly versus defined using function expressions seems like a good
one for a FAQ. Under what circumstances does it make a real
difference whether you use function expression versus function
statement versus Function object?
View 1 Replies
View Related
Jul 20, 2005
Here is the code:
function fnSelectOption(fieldname)
{
document.mainform. + fieldname + .value = "value";
}
It obvliously bombs where I am trying to ref the param "fieldname". I
realize it is a simple syntax issue but I cannot seem to figure it out.
View 10 Replies
View Related
Oct 27, 2010
I have a text string that is a complete html doc. How do I tell jquery to parse that?
Variable theDoc holds the other html doc.
I tried:
var doc = $(theDoc);
If it is "this" doc it looks like: var x = $('table:contains('test')).html(); I tried: var x = doc.find('table:contains('resume')).html();
It keeps saying something is null.
So what is the syntax to look inside another doc , not the one the code is currently in?
View 2 Replies
View Related
Aug 10, 2010
What is the syntax for hiding div tag for safari, firefox, chrome.In my webpage i've 2 div tag, based on the condition i'll show any one at a time.Can any one give a syntax to hide div in all kind of browser.
View 1 Replies
View Related
Apr 7, 2011
What would the correct syntax be for this:
if('#loaded_max' == 3) {
loading = false;
}
View 3 Replies
View Related
Jul 23, 2005
Recently writing some code i cross over a problem using document.write:
View 2 Replies
View Related
Jul 23, 2005
Trying to debug someone else's javascript code. There is a line that
looks like this:
req = req.substring(req.length-2, req.length);
From what I can gather in their comments, they want to capture the last two characters of the string "req".
I'm guessing that the above line won't do that, and they want to change it to
req = req.substring(req.length-1, 2);
In other words, the parameters are starting position, and length. Is that correct?
View 6 Replies
View Related
Apr 3, 2006
I discovered this syntax on the google example of a client to their web
service.
function PagClass()
{
this.init();
}
PagClass.prototype = {
init : function() {
this.m_bInited = true;
this.m_nTotalRows = 0;
this.m_nFirstRowNum = 0;
this.m_nRowsPerPage = 0;
this.m_nNumPages = 0;
this.m_nReportid = 0;
this.m_nResultNumStart = 0;
this.m_strStart = "";
},
foo: function() {...},
bar: function() {...}
}
This seems like a very elegant way to create classes in javascript,
gives you a constructor and lists methods as comma separated
properties.
My colleague is suspicious that there may be excessive runtime overhead
associated with the prototype, property list way of doing this.
Anybody know for sure?
View 1 Replies
View Related
Dec 15, 2006
I'm looking at some code I do not understand:
var icons = new Array();
icons[""] = new GIcon();
icons[""].image = "somefilename.png";
I read this as an array of icons is being built.
An element of the array is an object itself but what is this syntax of
the consecutive double quotes inside the brackets ?
View 2 Replies
View Related
Aug 23, 2007
I had a look at sIFR.js code after parsing it and I have a question
about function syntax. For example
var f=function(){
// statements here
}();
What is the purpose if the second set of parentheses following the
closing brace? Is the intention to execute the function immediately
after it has been defined?
Most functions in sIFR.js do not have this syntax, but a few do.
View 1 Replies
View Related
Sep 11, 2007
var BN = {
foo: function() {
alert("hello world");
},
z: function() {
alert("hello world");
},
}
I would like to add a member moo to BN whose definition is
var moo = {"a":"A","b","B"};
How do I do it?
View 9 Replies
View Related
Jul 20, 2005
I know only little of javascript and have trouble with the syntax of a
function this is the function
function ClipBoard( VARIABLE)
{
holdVARIABLE.innerText = VARIABLE.innerText;
Copied = holdVARIABLE.createTextRange();
Copied.execCommand("Copy");
}
probably needless to say, but it doesn't work.
How can i get this function to work?
View 3 Replies
View Related
Nov 6, 2011
Was wondering, other then the syntax difference, should the below to bits not end up with the same result?
$("details").not("summary");
$("details :not(summary)");
View 2 Replies
View Related
Jul 16, 2009
addMainItem('index.html';'::Home';mwidth;'center';'';'';0;0;'');
The above line of code in my navbar is crapping at me for having bad syntax, something about lacking a closing brace. Clearly, I have a closing brace.
View 34 Replies
View Related
Jul 30, 2009
I just need someone to tell me what the proper syntax is for calling a perl sub from another perl sub.. in trying to use onClick to call a sub in Htmlform() .. but its not working... the cgi works fine.. the mySql parts work fine.. more specificallyprint start_html(-title=>'Lab 6',-scrip=>{-language=>'PerlScript', src=>'mySqlProg.cgi'});i dont know if the above is the corect syntax in relation to thisprint "<button type='button' value='view' onclick='show_entries();'>Show Table Values</button>";
#!/usr/bin/perl
use strict; use warnings;
use CGI qw/:all/;
[code]....
View 4 Replies
View Related
Feb 2, 2010
Alright so for my website (I've totally revamped it and what not) I want to make a code highlighter for source code / tutorials I've posted. At the moment I'm just using some css:
div.code
{
font:1em "Courier New";
margin: 10px auto 10px auto;
background-color: #FFFFFF;
border: thick solid #555555;
color: #000000;
white-space: pre;
font-size: 12;
}
So the code stays neat and in a box. But what I want to do now is somehow make a small javascript function that scans the text inside the html file etc :
[Code]...
and can format it so float and int is blue, "hello world" is red etc. As from the javascript I've done myself I can't see it being to hard. I'm just unsure how to scan for text inside like I have above.
View 3 Replies
View Related
Dec 8, 2010
With Javascript and need a bit of validation done but I have no idea what the problem is with my code:
Form:
Im sure there are a few syntax errors.
View 4 Replies
View Related
Apr 15, 2011
I am just learning the basics and am trying to figure out timing with setTimeout()
<script type="text/javascript">
document.write("<p>" + Date() + "</p>");
setTimeout("document.write('Hello There World');", 2000);
setTimeout("document.write("<p>" + Date() + "</p>");", 2000);
</script>
the 1st document.write works and the 1st setTimeout() works, but then I add the fourth line and the page will not load.
Why does it not like my 4th line : "setTimeout("document.write("<p>" + Date() + "</p>");", 2000);"?
View 6 Replies
View Related