Doctype Declaration Must Be On The Very First Line?
Oct 19, 2010is it true that the doctype declaration must be on the very first line (there mustn't even be a blank line above it) in order for it to be "working correctly" ?
View 8 Repliesis it true that the doctype declaration must be on the very first line (there mustn't even be a blank line above it) in order for it to be "working correctly" ?
View 8 Replieshow to read a text file using javascript line by line and separate from special characters in it. for example
Text.txt has
001203=Line one=abc.html
024353=Line two=xyz.html
092434=Line three=hjf.html
i want each column in an array like { 001203,024353,092434 } so total 3 arrays.
getting first line coordinates of multiple line inline element.
Example HTML
aaa bbb ccc ddd <span id="target">eee fff ggg
hhh iii jjj</span>kkk lll mmm nnn ooo ppp qqq
$(document).ready(function() {
[Code]....
Assume that span#target has a line break, when I see a browser. Then I click span#target, above function returns the head of coordinates which second line ("hhh") has. I want to have the coordinates which first line ("eee") has. How can I get that?
reading file in jQuery. Please if anyone knows how to write tome or to the website.
$.get("data/zelis.si.txt",function(data){
$.each(lines, function(n,line){
$.ajax({
[code]....
What is the difference between:
function setupGrid( param ){......}
and
setupGrid = function( param ){......}
Are there any advantages to doing one over the other?
There is something that I don't understand well, I use array for
combining strings like
items = ['hello world', ', how are you', '?', 'the end'].join('');
in FF this works well but in IE I had to add something like this
var items = new Array();
items = ['hello world', ', how are you', '?', 'the end'].join('');
My question is why is there a need for var items = new Array(): and
why items = new Array(); doesn't work? I don't want the items to be a
global variable, since it was declare inside a function I want it to
be local only.
i wonder how can i have both javascript writen inside body and css declaration
here's my page: i only see the output if i comment the css line: Code:
which is the best DOCTYPE to use with JavaScript?Just validating now and its telling me that the<body onLoad="startclock()"> onLoad attribute is not supported....
View 6 Replies View RelatedI know that IE6's support for CSS is well... hmmm... lets just say not very good, however I was wondering if style declarations can be added at run time, via JS?
e.g.
Can I create a new rule?
Below are some over simplified examples of code the create a single
instance of an object and I was hoping some one could give me the pros
and cons of each approach.
First declaration: In this case a single object is created using object
literal notation and both the get and __Private methods are availabile
for use and no closure is created.
ABC.Util.SomeObject =
{
get : function(val)
{
return this.__Private(val);
},
__Private : function(val)
{
return "testing";
}
}
Second declaration: In this case a single object is create and only the
get function is availabile for use and a closure is created.
ABC.Util.SomeObject = function()
{
var __Private : function(val)
{
return "testing";
}
return {
get : function(val)
{
return __Private(val);
}
};
}();
I have the following code which attaches a function to events in x number of comboboxes (x will probably always = 4, but I do not want to hard-code this). I wish to pass the value of i to the function being attached as well as the value of tempData. In other words, I want the parameters in function to be the value, not a reference variable.
In the current example, I am using the hard-coded variable ci. This I want to be replaced by a literal created when the event handler is attached (the value of the loop variable i). Also, notice that I get the filter value in the event handler (assigned to the variable ct). I would like to replace this code with the value of tempData which would also be determined when the evenet is attached (it is the same value in this case, but it keeps the onChange event from having to do this each time it runs).
var props = {
col_0: "select",
col_1: "select",
[code]....
I've been looking all over for an explanation of this function declaration but cant find it. what it means to have a function with no name, just declared as this. When does it execute? How does it get called?
For reference, here's the function:
Say I have a code snippet like the one below:
var elm1 = document.getElementById('elm1');
var elm2 = document.getElementById('elm2');
function doStuff(e) {
// Some stuff is done here...
}
function addListeners(e) {
elm1.addEventListener('click', doStuff, false);
elm2.addEventListener('click', doStuff, false);
}
window.addEventListener('load', addListeners, false);
This code will generate an error, namely "elm1 has no properties". To many I guess this isn't very surprising, and my own take on this is that the addListeners function is run before the variables are declared. But what I fali to see is why? To me, a fair beginner with JS, everything is in its right place. What am I missing?
I would very much appretiate if someone could explain the order (when and where to declare the different parts) in which my code here should be ran. Is there something special to have in mind when using window.addEventListener('load', functionname, fasle);?
i did not undestand weather 'var' Keyword should be used or not when declaring variables. i already familier with php and there i will not use a 'var' for variable declaration. i like to program JS using similler PHP sysntax. so i code JS with out 'var' for varialb declarations and it works.
but can you please tell is it ok to declare variables with out the key word 'var'? if this is not good, then do all global and local variable declarations requir 'var'?
How do I read a local text file line by line, one line at a time. I got upto opening a file, and can read whole file at a time. But I want to read just one line at a time. May be have a counter of lenght of the file and read only the counter number line at a time.
<SCRIPT language=JavaScript>
var fso = new ActiveXObject( 'Scripting.FileSystemObject' );
f = fso.OpenTextFile( "c:\mytextfile.txt", 1 );
[Code].....
I was roughing out a feature I want to add to my site in notepad with no doctype declare.I got it just how I wanted, then realized it didn't work in IE. I added a doctype, it validates at xhtml strict, but it killed IE, while it started adding round corners in IE which wasn't working with no doctype...but now my JS isn't working... So I lost functionality of the JS while adding the round corner style that wasnt working when the JS was mostly working...FF works fine every damn way of course....I uploaded it to http://[url]......Also when it was functioning, the lower set of icons background wasn't showing. You can load that link ^^ in FF to see exactly what I'm going for....it works in ff
css:
body {
margin: 0px;[code]....
I have a javascript (snow.js) on my website. Without a DOCTYPE in my HTML it runs in IE, Mozilla and Chrome.Because my mouse-overs (hover) were not working in Chrome I needed to add a DOCTYPE, after it worked (DOCTYPE : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:[url].....).
But my javascipt still works in IE but not in Mozilla and Chrome anymore. This script runs with the following statements after <body> :
<script language="JavaScript" src="snow.js">
</script>
I have been having trouble with forms and functions. On my wife's site I have some forms and some of them have radio buttons. My current radio button checker is cumbersome and it is time for something more elegant (some of you will say if it isn't broke don't fix it )
The new code is below:
Code:
Basically I want to pass into the function radio button values 1 & 2 denoted by firstChoice and secondChoice (eventually I want to also pass in the form name but 1 step at a time).
The buttons can have the value (names?) of pattern, chalkboard or kit. It is for a shopping cart (Mal's E-commerce) and this is part of the JS validation. I am using onsubmit to call the function viz.
HTML Code:
Seems ok (to me at least) but when I try to get it to work it throws up an error of
Code:
It stops at that point but undoubtably chalkboard would throw up the same error if it continued.
How would I define the variables in my function? Are they strings, integers, who cares?
Where would I define them? Global or local?
Is the problem a matter of syntax e.g. if I put ' ' or " " around them would that suffice?
I have the javascript (which is pasted at the end of this request) on my website, but it will not work whenever I include the Document Declaration just above my <head>.
Is there something I can change in the code that will make it work?
The top part is in the head and the second part is at the end of the html code.
Here is the code:
<SCRIPT LANGUAGE="JavaScript">
<!--
floatX=25;
floatY=125;
layerwidth=100;
[Code]....
I'm creating matrix of values like this:[code]Usually when i want to access position like Matriz[0][0] y retrived the value "", now for some reason when i debug appears "indexOf" at the beggining and when I access Matriz[0][0] I get "undefined".Someone knows why is happennig this, i'm using IE 6
View 2 Replies View RelatedI understand that there is no need to initialize a variable at the point of declaration. OTH, what is the default type of a [declared] variable? For example:
[Code]...
I had to add the following DOCTYPE to a webpage in order for IE to parse my page design properly, and this caused the form on the page to fail in FireFox (which works fine without the doctype). The form works fine in IE.Here is the DOCTYPE I added to the top of the page;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
The error log in FireFox says;
frmTest is not defined - Line 30
Here is the block of code it is referring to;
function MoveForward(ipage)[code].........
This <div> layer positioned always at bottom left of the screen on scrolling (and calling some code from labpixies) works well in non-ie browsers, but in ie it requires the omission of the doctype declaration. Why? Is it possible to fix it so that it works with the doctype in ie?
<!doctype html>
<html lang="en">
<head>
<title></title>
</head>
[Code]...
I use the following script for a scrolling button, it scrolls down with you if you scroll down.
Only one problem, it only works if I don't use any doctype.
If I do, the script stops working.
But without a doctype my CSS is rendered different, so that's not what I want ofcourse.
Somebody got an idea on this one? Code:
I have a section of Javascript code that works a treat in IE but does nothing in Firefox. If we remove the doctype it appears to work, put the doctype back in and it breaks. We need the doctype to remain in so the page renders correctly cross-browser. Code:
View 2 Replies View RelatedFor a variety of reasons that I won't currently go into, I need a lightbox script that doesn't rely so heavy on the document's DOCTYPE (Strict, Transitional, etc) and will just work with a page where the DOCTYPE doesn't get assigned.
View 5 Replies View Related