Jump to content
xisto Community

galexcd

Members
  • Content Count

    1,313
  • Joined

  • Last visited

Posts posted by galexcd


  1. Sorry, it took a while to get back to you. I've been quite busy the past few days.

     

    Anyway, I wrote up a quick and minimal javascript function to do all the work you want for you. It supports any level drop down boxes, so if you want to add a 4th drop down box, it should work just fine.

     

    Basically to get it working all you have to do is set up your select options in the way described below, and then copy and paste the block of javascript code somewhere after your select boxes.

     

    To set up the select options, first, add onChange="update(this)" as an attribute to the select element. Then for each select element, add all possible options under that element and set the class equal to the value of the prerequisite.

     

    Here is a simple example:

    <form name="formname" method="post" action="">	<select name="one" onChange="update(this)">		<option value="">Select #1</option>		<option value="numbers">Select Numbers</option>		<option value="letters">Select Letters</option>	</select>		<select name="two" onChange="update(this)">		<option value="">Select #2</option>		<option value="1" class="numbers">1</option>		<option value="2" class="numbers">2</option>		<option value="3" class="numbers">3</option>				<option value="a" class="letters">a</option>		<option value="b" class="letters">b</option>		<option value="c" class="letters">c</option>	</select>		<select name="three" onChange="update(this)">		<option value="">Select #3</option>		<option value="1.1" class="1">1.1</option>		<option value="1.2" class="1">1.2</option>				<option value="2.1" class="2">2.1</option>		<option value="2.2" class="2">2.2</option>		<option value="3.1" class="3">3.1</option>		<option value="3.2" class="3">3.2</option>				<option value="a.1" class="a">a.1</option>		<option value="a.2" class="a">a.2</option>				<option value="b.1" class="b">b.1</option>		<option value="b.2" class="b">b.2</option>				<option value="c.1" class="c">c.1</option>		<option value="c.2" class="c">c.2</option>	</select></form>
    In this example, we want the options a,b, and c, to show up when the user selects "letters" under the first drop down. Therefore, we set the class equal to "letters". Etc...

     

     

    And here is the javascript to be inserted anywhere after the select options:

    <script type="text/javascript">var s=Array();var c=Array();var a=document.getElementsByTagName("select");for(i=0;i<a.length;i++){	b=a[i].options;	s[i]=Array();	c[i]=Array();	for(j=0,k=0;j<b.length;k++){		s[i][k]=b[j];		c[i][k]=b[j].className;		if(c[i][k]!="")b[j]=null;		else j++;	}}function update(obj){	for(n=0;n<a.length && obj!=a[n];n++);	if(++n>=a.length)return;	while(a[n].options.length>1)a[n].options[1]=null;	for(i=0;i<s[n].length;i++)		if(c[n][i]=="" || c[n][i]==obj.value)			a[n].options[a[n].options.length]=s[n][i];	a[n].value="";}</script>

    And now putting it all together using your structure of countries->airports->cities...

    <form name="formname" method="post" action="">	<select name="Country" onChange="update(this)">		<option value="">Select Country</option>		<option value="Spain">Spain</option>		<option value="Turkey">Turkey</option>		<option value="Greece">Greece</option>	</select>		<select name="Airport" onChange="update(this)">		<option value="">Select Airport</option>				<option value="Barcelona" class="Spain">Barcelona</option>		<option value="Gerona" class="Spain">Gerona</option>		<option value="Malaga" class="Spain">Malaga</option>		<option value="Alicante" class="Spain">Alicante</option>		<option value="Madrid" class="Spain">Madrid</option>				<option value="Antalya" class="Turkey">Antalya</option>		<option value="Bodrum" class="Turkey">Bodrum</option>		<option value="Dalaman" class="Turkey">Dalaman</option>		<option value="Istambul" class="Turkey">Istambul</option>				<option value="Rhodes" class="Greece">Rhodes</option>		<option value="Athens" class="Greece">Athens</option>		<option value="Heraklion" class="Greece">Heraklion</option>		<option value="Corfu" class="Greece">Corfu</option>		<option value="Zante" class="Greece">Zante</option>	</select>			<select name="City" onChange="update(this)">		<option value="">Select City</option>				<option value="Barcelona was selected #1" class="Barcelona">Barcelona was selected #1</option>		<option value="Barcelona was selected #2" class="Barcelona">Barcelona was selected #2</option>				<option value="Rhodes was selected #1" class="Rhodes">Rhodes was selected #1</option>		<option value="Rhodes was selected #2" class="Rhodes">Rhodes was selected #2</option>				[Replace me with more options for each airport...]			</select></form><script type="text/javascript">var s=Array();var c=Array();var a=document.getElementsByTagName("select");for(i=0;i<a.length;i++){	b=a[i].options;	s[i]=Array();	c[i]=Array();	for(j=0,k=0;j<b.length;k++){		s[i][k]=b[j];		c[i][k]=b[j].className;		if(c[i][k]!="")b[j]=null;		else j++;	}}function update(obj){	for(n=0;n<a.length && obj!=a[n];n++);	if(++n>=a.length)return;	while(a[n].options.length>1)a[n].options[1]=null;	for(i=0;i<s[n].length;i++)		if(c[n][i]=="" || c[n][i]==obj.value)			a[n].options[a[n].options.length]=s[n][i];	a[n].value="";}</script>

    Additional notes:

    I wrote this javascript myself from scratch. Anyone can use it for any reason without giving any credit to me.

    (I hate people who write simple code like this and add their name in the comments. I mean seriously, you didn't write a library, it's a simple piece of code that took 30 seconds to write... </rant>)

     

    Post-post script:

    I know my coding style isn't very readable, but this is ideally how people should write javascript. Javascript is interpreted therefore you should write it as minimal as possible to cut down on loading times. Consider yourself lucky that I didn't remove all whitespace and semicolons before close brackets.


  2. Easiest way of doing it without changing the structure of your code too much would be to just copy your dropdownlist function, and use that to check for changes on the second drop down list. Then create a third select element and hook the onchange attribute of the second select element to call the new javascript function you created. It's a bit messy, I'd probably do it a different way. If you want me to I could write you some cleaner code to do this for you when I get home from work tonight.


  3. i really loved that KS you added instead of START in windows :) .



    he didn't add 'KS' thats just a K and its part of the theme. :D at least i think so... i could be wrong :P


    It's not windows at all. His desktop environment is KDE. I'm more of an xfce guy so we are naturally rivals. However we come together with our mutual dislike of windows. I was actually going to edit the image to make it look like windows was running in a VM under opensuse with xfce, (but I was too busy to do it in time). I believe TF was going for more of a wine look with the hybrid windows/linux screenshot.

    Either way, this post is FAR too late for anyone to actually bother reading since what it's referring to is on the previous page. So, in that case I suppose I'll just stop here and move along. Nothing to see here.

  4. Hello,This code is working only in IE browsers and it is not suitable for other browsers
    How to ensure that the script is browser compatible.

    Hello vkthiru, and welcome to our forum.
    Avalon provided a cross-browser compatible pure css solution that I would recommend using over the OP's script. I have quoted this solution below:

    .image:link { opacity: 1.0; filter: alpha(opacity=100); -moz-opacity: 1.0; width: auto; height: 100px; }.image:visited { opacity: .65; -moz-opacity: .65; filter: alpha(opacity=65); width: auto; height: 100px; }.image:hover { -moz-opacity: .65; opacity: .65; filter: alpha(opacity=65,finishopacity=65,style=0); width: auto; height: 100px; }

  5. how about deleting members and their mycents who haven't logged in in a month. that's even better, don't you think?


    And members like me with a full-time job and 19 unit school semester get to lose their accounts? I don't really mind about losing mycents since I'm not using them, but I would be rather annoyed if my account were deleted because I haven't had time to sit down and log in to my account in the past month.

  6. Any company with its own head office and its own IT support should have its own, private, on site email server.

    I completely agree, storing your company's private email data on gmail's webservers seems like it could have potential legality issues. Any business and school should use their own servers for something as important as email. However I am beginning to see many small businesses and schools start to use google apps for their employee/student email.

  7. Google's April fools did not match up to their usual goodness. However, they added some neat things to some of their other products like Youtube's text mode, Google doc's cloud for your keys/remotes, and Google Wave's actual human notifications.

    However I think that google doesn't take the cake this year for the best April Fools joke. reddit has added the ability for everyone to be an admin, which is really clever.
    However, my favorite by far would have to be XKCD's unix-like terminal (hint: type in emacs, and vim hahaha).

    Edit: in XKCD type in "make me a sandwich", then type in "sudo make me a sandwich" HAHAHAHhahaha


  8. You shouldn't have wasted your time by doing this.

    I completely disagree. I think even if the final result is uninteresting it still is a great learning experience and most likely increased the OPs proficiency in whatever image manipulation software he or she uses.
    As for my critique of the image itself, I think it was composited very well. The added fur below the jaw really has some depth to it. I look forward to seeing the final draft of the image.

  9. Is there an option in this site to see The historix of all teh post that you have either created or replied too?
    If there is where can I find it?


    Demo100, please note that some sections of the forums such as web design do not display your post immediately. A moderator must approve it first. Please do not repost the same topic multiple times because they did not show up right away.

  10. Zagubadu is referring to the rich text editor I believe. I don't think it has anything to do with quoting, other than when you want to quote someone you must use the full rich text editor rather than the fast reply standard text area. The rich text editor actually uses frames to render your text as you are editing it, while the simple <textarea> of fast reply only displays bbcode. Normally this method of rendering your post while you type works fine. However perhaps some update in your browser or some change to the website broke it.

     

    I am actually having the same issue with the rich text editor at the moment. Since I almost always use the fast reply I'm not sure when this issue started for me, however I recently updated Firefox to 3.6. Looking at the source for the frame leads me to believe it may be some issue with the website because if I recall correctly to allow a page to be editable you must include a line of java script:

    document.designMode="on"
    ... again, i may be wrong (it's been ages since I wrote my own rich text editor). Or there may be a new better way of doing it using pure css/html5.

     

     

    Edit: After a quick Google search I found that there is a newer way of doing this:

    <html id="ed-0_html">
    And the frame does implement it, so perhaps this method has some issues in Firefox?

  11. Steam is a great concept idea but a poor execution of this concept. I play a lot of Team Fortress 2, Left4Dead 1 and 2, as well as a few others so I deal with steam for practically all of my online gaming. I know how you feel however, my first impressions of steam were not that great, but it has moved to tolerable (most likely because I have gotten used to it). When I bought my first steam game (orange box) back in 2007, I didn't understand why I needed to download and install this other app. And on top of that why I had to create an account to be able to play these games; which by the way with the exception of Team Fortress 2 were all single player games. There are however some advantages to steam, below I have listed my oppinion of what Valve has done right and wrong with steam.

     

    Things Valve did right with steam:

    Digital downloads of all games attached to your account. Valve has removed the need for me to leave my house or wait to get a CD for a game. I can purchase it directly from the steam store and have it permanently attached to the account so I never have to worry about keeping track of all of my games. This is the concept of steam which works very well. After purchasing orange box I haven't bought a physical copy of a game in 3 years. Normally I am against this sort of DRM, but it has certainly made my life easier, especially when formatting my drive and installing a new OS.

    It certainly is convenient to be able to be able to chat with other players on the steam network while in game by just pressing shift+tab. I don't have to worry about alt-tabbing out and causing the game to minimize (which always is rather annoying because it takes a while for the game to come back).

    It does make it much easier for game makers to prevent piracy. If they release their game solely on steam, they do not need to write any kind of cd-key generating/checking algorithms. That doesn't affect the end user too drastically (unless that end user wants to pirate the game), but it is a huge benefit to the game creators.


    Places where steam goes terribly wrong:

    It is a HUGE resource hog. It very slow for just an app to help you launch your games and chat with your friends. It takes a while to start up, maybe not 60 mins (you might want to get your comp checked out there about that), but it takes about 30 seconds to launch it and connect to the steam network which is way too long for what it does. I understand they wanted to make the entire thing account based so when you open it up you instantly see what games you have attached to your account, but how about open the interface instantly and show what games were there last time your account was used and then sign onto the steam network in the background?

    The user interface is horrible. Not using the OS's default chrome makes it look out of place and creates problems when I attempt to run it under wine in linux.

    It is completely unnecessary to enforce the use of it for single player games other than DRM reasons. For multiplayer games steam allows players to have one account and friends list for all of their PC gaming. But there really is no use for this in single player games, yet because the game creators want to prevent piracy they lock it down to your steam account.



  12. That was a great intro fstab! Normally I don't care much for the introductions forum because most new members post the same basic "Hi my name is ... and I'm here for web hosting" intro and all the old members post a generic "welcome to Xisto" reply. But I was drawn by your name assuming you were a *nix guy, and I was right! I wish you the best of luck here, and I hope you enjoy your stay!


  13. I have added a rule to the opening post:

    Members who are requesting invites MUST be active members of the community. (This means you will not be added to the list if you have 0 posts)

     

    In other news, I have 9 more invites to give out! Congratulations to Kobra500, DeM0nFiRe, BCD, rvalkass, anwiii, The Simpleton, hype, kleong, and TheDisturbedOne! You were next in line to receive invites and I will be sending you information on how to redeem these invites. I will remove these names from the list as soon as they reply to my message with the requested information.


  14. Google Wave is currently in one of Google's infamous "invite only" stages. This thread is for the Xisto community to share any invites they may have with those who want it.

    You can learn more about google wave here.

     

    Because the Gmail invite exchange topic was so chaotic I will be moderating this thread and keeping things under wraps here. So make sure you read the rules before posting anything:

     

    The Rules:

    Do NOT post asking for invites. Your post will be immediately deleted. Instead, send a PM to either Galexcd or Jlhaslip asking to be added to the list of members who want invites.

    If you have an invite you are willing to share with the community, you can go ahead and post here notifying how many invites you have and who you sent them to so I can mark them off the list.

    When you give invites away, please give them away to the next members in line in the list.

    Do NOT post your email anywhere in this thread, because there are tons of spam bots just dying to get it.

    You must be an active member of the community to request an invite. You will not be put on the list if you have 0 posts.

    If you receive an invite from please return the favor and give out a few invites to those who don't have it.

     

    Here is the list of members who have requested invites in the order they requested them:

    * Names that are Striked Out have already been nominated to receive their invites.

    * Names that are bold have invites waiting for them. (They just need to reply to the PM).

    Jlhaslip

    galexcd

    Saint Michael

    Kobra500

    DeM0nFiRe

    BCD

    rvalkass

    anwiii

    The Simpleton

    hype

    kleong

    TheDisturbedOne

    rpgsearcherz

    rayzoredge

    serverph

    magiccode9

    chezo

    mahesh2k

    Dak1ng

    inverse_bloom

    nameless


  15. The only reason I mentioned the OS and browser is that it does not happen to me at all when using Firefox in Ubuntu. Yet it happens about every 5 minutes in Safari in OS X. But who knows, I didn't really think it was an OS/Browser issue, but the fact that it differs so much for me between the two OS's I use is quite odd.


  16. Just an interesting point here, whenever I am on Xisto using safari on OS X the same thing happens to me. I get logged out after about 1-2 mins. This isn't a huge concern to me because I am usually booted into linux, but I find it interesting that another member is experiencing the same issue. I wonder if it is the browser or the OS that is causing the problem...

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.