Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by midnite

  1. oh, thank!!i forget that the "var" is extremely important in JS..and also, the nested loop approach will create a lot of redundant recursive calling =(Thanks a lot for helping me and picking my error =)
  2. i prefer checking the referrer. But can ajax retrieve the referrer? i bet not. So you should do the validation again in the server side. It add loads to your server, but it seems to be the only choice
  3. <html><head> <script language="JavaScript"> function setTo(inherit, fontSize){ inherit.style.fontSize = fontSize; inherit = inherit.childNodes; for (i=0; i<inherit.length; i++){ for (j=0; j<inherit[i].childNodes.length; j++){ setTo(inherit[i], fontSize); } } } </script></head><body> <span id="title01" style="font-size:20px">Here <span style="font-size:90">is</span> the sample text</span><br> <button onclick="setTo(document.getElementById('title01'), 10)">change to 10px</button></body><
  4. <html><head> <style type="text/css"> .custom { font-size: 20px; color: red; } .default { font-size: 10px; color: blue; } </style> <script language="JavaScript"> function change(){ document.getElementById("title02").className = "default"; } function stripPx(text){ return text.substr(0, (text.length>2 ? text.length-2 : 0)); } function enlarge(){ var elem = document.getElementById("title02"); elem.style.fontSize = stripPx(elem.style.fontSize) * 1.5; } function back(){ document.getElementById("title02").className = "custom"; } </script>&
  5. oh! great!!not using <font>, what should i use then? or what is better?
  6. <html><head> <style type="text/css"> .custom { font-size: 20px; color: red; } .default { font-size: 10px; color: blue; } </style> <script language="JavaScript"> function change(){ document.getElementById("title02").class = "default"; } </script></head><body> <font id="title01" class="default">Here is the default text</font><br> <font id="title02" class="custom">Here is the custom text</font><br> <button onclick="change()">change to default</button></body></html> here is
  7. midnite

    select reverse

    excuse me, let's say i have totally 10 seats numbered from 1 to 10 and people are randomly sitting on them.Yet, currently there are only 3 people and i have the table recorded: +------+------+| ppl | seat |+------+------+| andy | 7 || jen | 4 || amy | 3 |+------+------+ and now i would like to list out the blank seats +------------+| blank_seat |+------------+| 1 || 2 || 5 || 6 || 8 || 9 || 10 |+------------+ the idea is to list out the elements that the current table DO NOT have and its seat id is less than 10. i got the idea but don't know how to write the query. T
  8. pulpfiction, you are really genius!!i not only get your answer, but also learnt from it!! mysql> SELECT * FROM ranking;+------+-----------+------+| rank | uni | area |+------+-----------+------+| 1 | Oxfrod | UK || 2 | CamBridge | UK || 3 | UST | HK || 4 | Impreial | UK || 5 | HKU | HK || 6 | MiB | UK || 7 | Impreial | HK |+------+-----------+------+7 rows in set (0.00 sec)mysql> SELECT uni, area, (SELECT COUNT(*) FROM ranking r2 WHERE r2.rank <= r1.rank && r1.area = r2.area) AS new_rank FROM ranking r1 WHERE r1.uni = 'Impreial';+----------+------+
  9. i am sorry if i didnt make it clear enough...i want it ranks in UK only. mysql> SELECT uni, rank AS area_rank FROM ranking;+-----------+-----------+| uni | area_rank |+-----------+-----------+| Oxfrod | 1 || CamBridge | 2 || UST | 3 || Impreial | 4 || HKU | 5 || MiB | 6 |+-----------+-----------+6 rows in set (0.01 sec)mysql> SELECT uni, rank AS area_rank FROM ranking WHERE uni = 'Impreial';+----------+-----------+| uni | area_rank |+----------+-----------+| Impreial | 4 |+----------+-----------+1 row in set (0.00 sec) it gives me 4 instead of 3.
  10. for better descripe my problem, here comes an example: mysql> CREATE TABLE ranking (rank int primary key, uni varchar(20), area varchar(20));Query OK, 0 rows affected (0.01 sec)mysql> INSERT INTO ranking VALUES (1,'Oxfrod','UK'), (2,'CamBridge','UK'), (3,'UST','HK'), (4,'Impreial','UK'), (5,'HKU','HK'), (6,'MiB','UK');Query OK, 6 rows affected (0.00 sec)Records: 6 Duplicates: 0 Warnings: 0mysql> SELECT * FROM ranking;+------+-----------+------+| rank | uni | area |+------+-----------+------+| 1 | Oxfrod | UK || 2 | CamBridge | UK || 3 | UST | HK || 4 | Impreial | UK
  11. midnite

    SQL <> MySQL

    yes, it's true. Every software have some special alterations, that they will add some self-developed functions that they think those will make the queries run faster and smoother. So, in another words, their SQL are not that standard. But you need not worry. The basic stuff are all the same
  12. first of all, really a BIG THANKS to Yahweh!! You really genius!!aspnetguy and jesh, also thanks very much for your help.in fact, what i want to do is to keep the list tidy. Let's say there are 5 rows and originally their id are 1 to 5. If id=3 have left, the list will become 1,2,4,5. So i would like to make it to 1,2,3,4. Hope you understand :]For instant, i have think of two approaches.1) using AUTO_INCREMENTwhenever a row is deleted, change the largest id to the one deleted if the id of the row being deleted is less than the largest id.(exceptional case occurs when the largest row is the on
  13. aspnetguy:MySQL still complaining that the same table cannot appear in both INSERT and the FROM clause..it seems that MySQL and Access are using something quite different.Yahweh:Oh thanks!! It works fine.But how to alter the SQL if my table got more than one column? The one i raised is just an example and make things simpler. The real thing of course having many columns, a single one can do nothing.
  14. excuse me, how to insert one row right after the largest one?for example: +----+| id |+----+| 1 || 2 || 3 || 4 |+----+mysql> INSERT INTO acc_list VALUES ((SELECT max(id) FROM acc_list)+1);+----+| id |+----+| 1 || 2 || 3 || 4 || 5 |+----+ this is a fake one of course. The SQL is incorrect! But it at least showing the concept and let you understand my problem. It can be done by two queries. But making it in one single query can prevent some errors and speed up performance.It can also be done by AUTO_INCREMENT. But in my case, using AUTO_INCREMENT will not be that handy.
  15. oh sorry, it gives me this ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY ac1.id' at line 1 i just wonder if UPDATE queries can use GROUP BY ?
  16. this shouldnt be a difficult problem, and it is quite typical. But just i cant find my way outit is just referring to its own table. as stated in the mysql doc and here seems to be explaining and solving the problem by INNER JOIN. But i dont get it.in fact, what i want to do is: updating the maximum value to a certain value.it will be very nice if the follow query works, but it doesnt!UPDATE acc_list SET id = 7 WHERE id = (SELECT max(id) FROM acc_list); so i tried the JOIN method, but it says Invalid use of group function UPDATE acc_list ac1 inner JOIN acc_list ac2 on ac1.id = max(ac2.id)
  17. midnite


    Thanks very much. what i want is actually not a page with fixed height. i stick back to the <TABLE> method and now everything is fine
  18. midnite


    i want a *NON-TABLE* method.i do *NOT* want to use <TABLE> to do this.
  19. midnite


    how can i make a footer that's *ALWAYS* visually bottom of the page?if the content is short that no scrolling is required, the footer text will stick to the bottom of the page likes what we do with the scripts position: absolute; bottom: 0; if the content is long that need scrolling, the footer text will just as if it is appending to the end of the pagei know that <TABLE> can do it, yet is there a style sheet method??
  20. midnite

    Grouping selectors

    oh.. i see. i did have a wrong concept towards grouping selectors. Grouping selectors are *just* for the reason that they all share the same properties. But *NOT* taking any "common factors" of the selectors. Such as .abc xxx, yyy { color: red; } is equivalent to .abc xxx { color: red; } yyy { color: red; } but *NOT* .abc xxx { color: red; } .abc yyy { color: red; } me gotta be careful from now on
  21. midnite

    Grouping selectors

    can it be "lesser"?as a:hover { text-decoration: underline; } a:active { text-decoration: underline; } can be grouped as a:hover, :active { text-decoration: underline; }
  22. midnite

    Grouping selectors

    excuse me, how to group the following lines into one? .link a:hover { text-decoration: underline; } .link a:active { text-decoration: underline; }
  23. oh.. i am sorry to be vague. What i wanna focus is the speed in term of system bus in the unit of MHz ..
  24. no, Windows XP is on my notebook. If one (Windows or Linux) is better, that's fine. Because i will try different OS on both computers soon
  25. excuse me, how can i know my CPU Front Side Bus Speed if my CPU is already not on the list of the vendor's hit items? For instant, my notebook is a P4 M with 2.00GHz, family 15, model 2, stepping 7 (i don't know all these yet i hope they help). i can't find any matches in the site of Intel. And one more, my old old desktop having a AMD K6 3D processor, 64 KB Cache, CPU family 5, model 8, and running Gentoo Linux.For the RAM, i can't find any label (physically) on some of my RAM. How can i know their speed?i did try to find those speed, of CPU FSB and RAM, in the BIOS while boot, yet i failed a
  • Create New...