Jump to content

raimo

Members
  • Posts

    132
  • Joined

  • Last visited

Everything posted by raimo

  1. There is 2 head parts in Your page, only one is allowed.Middle of body is other head, and DTD is splitted to lines wrong way.it should be splitted as: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> one small typo in CSS (mmsstyles.css)#menu li{postion: relative;}postion should be position
  2. Can't see any difference out there with my browsers.It looks just the same with Opera 9 (Linux beta 241) , Firefox (Linux 1.5.0.2) and Epiphany (2.14.1),I mean just the same. :)Anyway, there is some margin and badding bugs in Opera 8.x versions, those bugs will be fixed in incoming Opera 9.
  3. You can't use break outside of loops:if (a >= b) { break; }if (inspectedCars.length < 2) { break; } this way You can do:if (a >= b || inspectedCars.length < 2) return false; Fixed and cleaned it a bit, I'm not sure how it's working,but anyway there is no errors or warnings anymore. <script type="text/javascript"><!--function sortList(a, b){if (a >= b || inspectedCars.length < 2) return false; var pivot = inspectedCars[b].vendor; var left = a; var right = b-1;var tempCar = new Object(); while (left <= right){ while (left <= right && inspectedCars[left].vendor <= pivot) left += 1; while (right >= left && inspectedCars[right].vendor >= pivot) right -= 1; if (left < right){ tempCar = inspectedCars[left]; inspectedCars[left] = inspectedCars[right]; inspectedCars[right] = tempCar; } } tempCar = inspectedCars[left];inspectedCars[left] = inspectedCars[b];inspectedCars[b] = tempCar; sortList(a,left - 1);sortList(left + 1, b);return "something"; //only removing FireBug warning here;)}//--></script>
  4. .. onsubmit="return checkExt(this.userfile.value)> ..last " is missing there, should be:onsubmit="return checkExt(this.userfile.value)">that's the reason it not working I quess.Please put javascript block into the head part of Your document.By the way, here is final version, fixed to work with Opera, and filenames as file.is.this.png can be used too.function checkExt(s){if (!s) return false;var OK = false;var accept = new Array("jpg", "png", "gif");;var tmp = s.split('.'); if (!tmp[tmp.length - 1]) OK = false else for (var i = 0; i < accept.length; i++) if (accept[i].indexOf(tmp[tmp.length - 1].toLowerCase()) > -1) OK = true; if (!OK) alert('Accepted files are: ' + accept); return OK;}
  5. For that reason I'd first check in client side with javascript, before uploading,and cancel upload if wrong files are tried to upload.And then check it (and filesize) again in server side with PHP (or in my case with beutiful Perl)It is userfriendly way to do upload, no wasted time if filetype is mistakely wrong.Calvin: can't see why it is not working. I'd tested it with firefox.But anyway there is many good scripts in Googles head. .Remember form enctype: enctype="multipart/form-data" it must be that in file upload.
  6. thanks. here is updated version (always must be a updated version) :)Now they can't send files without extension:function checkExt(s){if (!s) return false;var OK = false;var accept = new Array("jpg", "png", "gif");;var tmp = s.split('.'); if (!tmp[tmp.length - 1]) OK = false else for (var i = 0; i < accept.length; i++) if (accept[i].indexOf(tmp[tmp.length - 1].toLowerCase()) > -1) OK = true; if (!OK) alert('Accepted files are: ' + accept); return OK;} edit:fixed to the final version.
  7. Here is one, my selfmade <script type="text/javascript"><!--function checkExt(s){if (!s) return false;var OK = false;var accept = new Array("jpg", "png", "gif");;var tmp = s.split('.'); if (accept.indexOf(tmp[1].toLowerCase()) > -1) OK = true; if (!OK) alert('Accepted files are: ' + accept); return OK;}//--></script><form action="some.php" onsubmit="return checkExt(this.file1.value)" enctype="multipart/form-data"><input type="file" name="file1" /><input type="submit" value="Upload file" /></form>
  8. You can't do it with that upload dialog (with Opera You can) so You must do filteringafter user has selected file, but not uploaded it yet.I mean filtering files so that nothing else can't be uploaded than images.Check at selected file ext is valid image-file extension, first with javascript in client side.And then do the same filtering in server side: look the extension of file and block out all incoming files except *.jpg, *.gif, *.png. This way user can be warned before upload with "GRRR! images only can be uploaded!" javascript alert, and You can get wrong filetype upload canceled before upload. (via returning false to form onsubmit event).
  9. You can use accept attribute, but depends of browser how it works or works it at all.Types are mime types:<input type="file" accept="image/gif,image/jpeg,image/png">That will work with Opera (L9/241), but not in Firefox (1.5.0.2). http://www.w3.org/TR/html4/interact/forms.html#adef-accept"User agents may use this information to filter out non-conforming files.."I think You should first filter not accepted files with Javascript on client side, and then again in server side to be sure only image files can be uploaded.
  10. This one will work head part:<style type="text/css"><!--.hilite{background-color: #C0C0C0;color: inherit;}--></style><script type="text/javascript"><!--function getElements(){var rows = document.getElementsByTagName("tr"); for (var i = 0; i < rows.length; i++){ rows[i].onmouseover=function(){ this.className += "hilite"; } rows[i].onmouseout = function(){ this.className=this.className.replace("hilite" , ""); } }}//--></script> and to the body: <body onload="getElements()"><table summary=""><tr><td>tr 1</td></tr><tr><td>tr 2</td></tr></table> or You can just set class attribute as: this.setAttribute('class', 'hilite'); and then remove it: this.removeAttribute('class');Works with Firefox, Opera and Epiphany, I have no MSIE but should work with it too.
  11. raimo

    ajax/e4x

    look:http://w3schools.invisionzone.com/index.ph...indpost&p=19649
  12. raimo

    change font size

    DON'T YOU YELL to ME! Use CSS to change Your font size, and everything else style things too.there is tutorials all over the net, W3Schools for example.http://www.w3schools.com/css/default.aspSmall example:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>:</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><style type="text/css"><!--.size10{font-size: 10pt;}.size12{font-size: 12pt;}--></style></head><body><p class="size10">Size 10 font is here</p><p class="size12">Size 12 font is here</p></body></html>
  13. Why? font-family: verdana, arial, helvetica, monospace;or similar, but not only verdana by self.Reason is, verdana is not basicly included in all systems.
  14. raimo

    Colours

    Both gives #808080 with all real browsers!<body bgcolor="grey"> and <body bgcolor="gray">Use always quotes ("") with Your attributes. :)grey and gray are both valid color names and value will be #808080 with both, as You can see when look those W3C links I add,
  15. raimo

    Colours

    X11 colo(u)rshttp://en.wikipedia.org/wiki/X11_Color_NamesW3C says: both are the same, in all grays and greys! http://www.w3.org/TR/SVG/types.html#ColorKeywordshttp://www.w3.org/TR/css3-color/#svg-color
  16. raimo

    Tables or Css?

    without extensions:View -> Page Style -> Basic Page Style / No Style
  17. Nothing else bad with Microsoft innerHTML, but it is not W3C DOM. :)That is not big case at all, all browsers supports it fine.But some reason I try avoid to use it whenever i can, don't know precisely why. Probably I'v seen dream where bad MS innerHTML eats all beautiful W3C DOM nodes, or something. :)Yes, it can be done with innerHTML, it's faster and easier way too.Long story, innerHTML vs DOM:http://www.developer-x.com/content/innerhtml/default.html
  18. hmm? <b> and <i> are still in XHTML 1.1, if I can believe W3C? :)Those tags are not marked as deprecated (yet)?http://www.w3.org/TR/xhtml11/doctype.htmlXHTML 1.1 presentation module includes b, big, hr, i, small, sub, sup and tt tags.But <u>, <s> etc. HTML deprecated stuffs are already gone out in XHTML 1.1,and in XHTML 2 <b> and <i> are not existing anymore, so b and i will be setted as a deprecated "soon".http://www.w3.org/TR/xhtml2/elements.html
  19. raimo

    Colours

    It is a right spelling inside US too.Color | Col"or |(ku^l"~er), n. Written also colour. OF.color, colur, colour, F. couleur, L. color; prob. akin tocelare to conceal (the color taken as that which covers). from Dictionary 2.12.1 (linux) :)edit:http://dictionary.reference.com/search?q=colour
  20. raimo

    Class's

    border: none;
  21. whole font -tag is deprecated<b> and <i> are not yet, but they are planned to be as deprecated in future.use CSS with Your fonts.Add this style-block Your document head-part (or external CSS-file without style tags):<style type="text/css"><!--.bold_red{font-weight: bold;color: red;background-color: inherit;}.bold{font-weight: bold;}--></style> in body part:<span class="bold_red">Bold and red</span><div class="bold">Bold in here</div>Look, there is very good tutorial: http://www.w3schools.com/css/css_font.asp
  22. Do it with DOM <script type="text/javascript"><!--function getTxts(obj){ // many child nodesvar txt = "";var parent = document.getElementById(obj);for (var i = 0; i < parent.childNodes.length; i++) txt = txt + parent.childNodes[i].nodeValue;alert(txt);}function getTxt(obj){ // only one child nodevar parent = document.getElementById(obj);var txt = parent.firstChild.nodeValue;alert(txt);}//--></script><a id="mg" onclick="getTxt(this.id)">School</a><a id="mg2" onclick="getTxt(this.id)">School is cool</a><div id="div1">123</div><button onclick="getTxts('div1')">Get values</button> in XHML 1.1 name attribute can be used only with form-elements.So it is good idea to use id.edit:added div and function to get many child nodes
  23. Table has no height attribute, use CSS height:document.getElementById("doorzichtig").style.height = screen.availHeight + 'px';edit:this one works fine with Opera, but not in Firefox;function resize(){var myBody = document.getElementsByTagName('body')[0];document.getElementById("doorzichtig").style.height = myBody.clientHeight + 'px';}
  24. LOL! sorry, that was second mistake for I, testing it and forget change date back to -14.But now it's OK. Reason of that +1 is: JS year start from zero. January is month 0.
  25. Very nice piece of code indeed! Opera case is funny, if You put div overflow to scroll ..scrollTop will work fine with Opera, but not with textarea.And I'm using newest Opera 9 available (Linux build 241).
×
×
  • Create New...