#62616 - 24/01/2002 10:10
Another web authoring question...
|
carpal tunnel
Registered: 08/03/2000
Posts: 12341
Loc: Sterling, VA
|
Okay guys, got an interesting one for you:
I'm designing a site for my college band program. You can view it here:
http://www.wm.edu/CAS/music/band/new/
That's what I have so far.
What I need help with is this: for some of the links that will be in the bar on the left, I want the info to come up in the table on the right, without loading a new page. Does it make any sense to do it like that? I only say because the amount of info that will show up won't be worth a whole new page.
So what would I need for this to happen? All that the stuff there right now is tables. Nothing fancy.
_________________________
Matt
|
Top
|
|
|
|
#62617 - 24/01/2002 10:53
Re: Another web authoring question...
[Re: Dignan]
|
old hand
Registered: 30/07/2000
Posts: 879
Loc: Germany (Ruhrgebiet)
|
Hi.
Just trying to see if I understand you correctly:
All you want to do is to replace whatever is in the right "frame" (which is actually a table field containing a table with a single field) with some new content?
There are two ways to achieve this that I know off:
- use javascript and a < div name="" > < /div > part to encapsulate the part you want to replace
- use frames
I would prefer the second solution. Sure, it is slower, and it doesn't necessarily work with all text-based clients (lynx in particular) all that well, but at least it does work with them to some extend. Also, the "slowness" factor isn't _that_ big considering that you probably only want to load some text.
cu,
sven
_________________________
proud owner of MkII 40GB & MkIIa 60GB both lit by God and HiJacked by Lord
|
Top
|
|
|
|
#62618 - 24/01/2002 11:36
Re: Another web authoring question...
[Re: smu]
|
carpal tunnel
Registered: 08/03/2000
Posts: 12341
Loc: Sterling, VA
|
Thanks for the reply. Yes, I had thought about frames. But I relly don't want to lay that out. I just thought it would be neat to do it the other way. Where would I find such a script?
_________________________
Matt
|
Top
|
|
|
|
#62619 - 24/01/2002 16:42
Re: Another web authoring question...
[Re: Dignan]
|
member
Registered: 12/01/2002
Posts: 141
Loc: San Diego, CA
|
DIV has no NAME property. It has ID instead for this purpose.
What you want to do requires DHTML and is a btich to get working in both IE and Netscape. I've done it before, but I was luck and knew what my audience was using. The only sure way to get to to work smoothly requires I.E. 5.0 or Netscape 6.0 or better. I've attached a sample that should work in IE 5.0 and Netscape 6.0 or better. I tested it with IE 5.5 and Netscape 6.2.
P.S. I'm pretty sure this does what you want....dynamically change the page without reloading anything...great for mouseovers...my samples use actual links, but you could just as easily put the function in the onmouseover event.
Attachments
60886-IE_text_replace.html (154 downloads)
Edited by redbutt2 (24/01/2002 16:44)
_________________________
We need a bigger boat.
|
Top
|
|
|
|
#62620 - 24/01/2002 17:18
Re: Another web authoring question...
[Re: redbutt2]
|
carpal tunnel
Registered: 08/03/2000
Posts: 12341
Loc: Sterling, VA
|
Thanks a lot! I'll try that out. I particularly like the Old Macdonald part
IE 5.0 or later, huh? Hmmm, that may be an issue. I'll try it for now and see what happens.
Is there something that I can write to place on a page that will store a bit of info on a user in a file on the site? In other words, is there something that can sit on the page and tell me how many people are using which version of IE? Or do you guys think that would be too invasive? If otherwise, I can always get some kind of free form for people to fill out.
_________________________
Matt
|
Top
|
|
|
|
#62621 - 24/01/2002 17:43
Re: Another web authoring question...
[Re: Dignan]
|
member
Registered: 12/01/2002
Posts: 141
Loc: San Diego, CA
|
Nah...there's boatloads of Browser sniffers out there. It is totally common to detect the users browser without telling them. Hell, that JS I wrote for you did it...it just didn't log it. But, in order for you to capture it to a file, you have now moved into CGI's. This is really easy and totally doable, but you might just want to talk to your web-host and see if thier logs have that info (chances are they do unless they are doing no logging at all for you).
If you want to do it yourself. PERL makes this really simple...
#!/path/to/perl
open (LOG, ">>/path/to/your/file.log");
print LOG "$ENV{USER_AGENT}\n";
close (LOG);
exit;
(Save this to a file of course...this has to run on the server)
You will need to probably execute this with an SSI command wich means that you need to be able to use Server Side Includes on your server. You can also use and image source to fire it. Do a Google search for browser detection, I'm sure you;ll find a solution that is good for your situation.
Edited by redbutt2 (24/01/2002 17:48)
_________________________
We need a bigger boat.
|
Top
|
|
|
|
#62622 - 24/01/2002 17:53
Re: Another web authoring question...
[Re: redbutt2]
|
carpal tunnel
Registered: 08/03/2000
Posts: 12341
Loc: Sterling, VA
|
Thanks again! I think that CGI is a bit beyond me. That's where I get off the boat
Anyway, I'm glad to see that I can use some HTML in the text that gets popped up in the table (it's working now, check it out!), but anything that requires " or ' characters will, of course, mess it up. Is there any work-around for this? I'd like to at least use links in these text popups as well.
Thank you so much for the help! It's greatly appreciated!
_________________________
Matt
|
Top
|
|
|
|
#62623 - 24/01/2002 18:01
Re: Another web authoring question...
[Re: Dignan]
|
member
Registered: 12/01/2002
Posts: 141
Loc: San Diego, CA
|
You just need to "escape" the special characters.
i.e. If you want to send:
Check out "This New CD" from <i>The Band</i>
Write it like this:
Check out \"This New CD\" from <i>The Band</i>
_________________________
We need a bigger boat.
|
Top
|
|
|
|
#62624 - 24/01/2002 18:11
Re: Another web authoring question...
[Re: Dignan]
|
member
Registered: 12/01/2002
Posts: 141
Loc: San Diego, CA
|
There is something else that you can do with DHTML which is create "layers". Basically what you do is create a bunch of DIVs one after the other. You then use the Javascript to change the "visibility" of the layers. That way you don't have to put all the HTML you want into a single line inside a function call. This is a little more involved, and has equal browser trouble implications, but is something to think about. I'll post a code sample for that in a bit.
It's been a little bit...enjoy (see the attachment in the post below.).
Edited by redbutt2 (24/01/2002 18:46)
_________________________
We need a bigger boat.
|
Top
|
|
|
|
#62625 - 24/01/2002 18:46
Re: Another web authoring question...
[Re: redbutt2]
|
member
Registered: 12/01/2002
Posts: 141
Loc: San Diego, CA
|
Here is the div layer thing example. Check out the source. There are some comments that you should read. If you can't figure it out, let me know.
Attachments
60955-IE_text_replace.html (203 downloads)
_________________________
We need a bigger boat.
|
Top
|
|
|
|
#62626 - 24/01/2002 20:09
Re: Another web authoring question...
[Re: redbutt2]
|
carpal tunnel
Registered: 08/03/2000
Posts: 12341
Loc: Sterling, VA
|
Oh my God. I owe you, man. This is fantastic stuff! I only had troubles adding more DIV layers until I realized i copied and pasted something wrong It's very cool stuff. And it works sooo well. I definitely like this way the best. The other way, the only way I could see to get back to the original DIV layer was to refresh the page, so I created a "Home" button that simply linked to the parent frame. With this code the "Home" link now loads the top DIV layer! Woohoo!!
Hehe, sorry to sound so excited, but this is cool stuff
Again, thank you sooooo much!
_________________________
Matt
|
Top
|
|
|
|
#62627 - 24/01/2002 22:20
Re: Another web authoring question...
[Re: Dignan]
|
carpal tunnel
Registered: 12/11/2001
Posts: 7738
Loc: Toronto, CANADA
|
Glad someone pointed out the cooler way of doing this. There were plenty of less-cool alternatives that would allow you to get the same effect, but with a refresh of the entire page. Using SSI or even a bit of PHP and a few datafiles for the content you wanted to be dynamic.
With the jscript and frames you're knocking out people with Lynx, but I'm sure that doesn't matter to you.
Bruno
|
Top
|
|
|
|
#62628 - 24/01/2002 22:31
Re: Another web authoring question...
[Re: hybrid8]
|
carpal tunnel
Registered: 08/03/2000
Posts: 12341
Loc: Sterling, VA
|
Hehe, nope. Not too many band parents using Lynx. On the other hand, there might be a group who don't even have IE5+ That's what I'm worried about now. But 5.0 has been out since '99 hasn't it?? I'd think it's likely that most people have it by now, don't you? I'd think they would have a lot of problems otherwise.
Anyway, I seem to be having one small problem with the script. All in all, CSS works fine with it. However, I seem to have problems with the mousehover event. I have it set so that on a mouseover on a link, the text and background swap colors (bg turns green and text turns white). However, with links in the DIV tags, on a mouseover the text turns white, but the bg doesn't change, leaving you with white space! That doesn't look very good Anyway, is there anything I'm missing here?
_________________________
Matt
|
Top
|
|
|
|
#62629 - 24/01/2002 23:02
Re: Another web authoring question...
[Re: redbutt2]
|
carpal tunnel
Registered: 08/03/2000
Posts: 12341
Loc: Sterling, VA
|
Lastly, so I annoy you guys less often, could you perhaps point me to a good reference site? It's hard to find good ones on the net. For example, somehow I found www.w3schools.com, which tough me how to use CSS and in a very easy way.
I mainly need help on small issues, like the best way to create a password protected area for a site. Things like that.
Thanks again!
_________________________
Matt
|
Top
|
|
|
|
#62630 - 24/01/2002 23:37
Re: Another web authoring question...
[Re: Dignan]
|
addict
Registered: 06/11/2001
Posts: 700
Loc: San Diego, CA, USA
|
Oh my God. I owe you, man.
Yeah, Daniel (redbutt2) is our DHTML master at work. I don't think there's anything he can't do. If you want to see his work, just check out the MusicMatch Guide or Radio. Of course, his best work is on the tools for editing the Guide and Radio. He built an entire text editor/page builder in DHTML.
_________________________
__________________
Scott
MKIIa 10GB - 2.0b11 w/Hijack
MKIIa 60GB - 2.0 final w/Hijack
|
Top
|
|
|
|
#62631 - 25/01/2002 08:45
Re: Another web authoring question...
[Re: Dignan]
|
member
Registered: 12/01/2002
Posts: 141
Loc: San Diego, CA
|
No problem. Like svferris said...this is what I do. You shouldn't have much of a problem with the browser versions. Anyone that downloads IE from the MS site will get 5.5 or 6.0beta, and 5.0 has been out for so long that most of your audience will have it.
The mouseover stuff is a bit tricky. It looks like you took it out of the page (which looks great by the way). Just a personal preference here, but I wouldn't do what you are talking about anyway. Changing the whole background is pretty disruptive. I would just leave it like you have it with the underline effect changing on mouseover...that is elegant and fits the page well.
To answer your question though, you are probably missing the CSS to change the background color of the DIV. What you were probably doing is trying to change the BGCOLOR of the table cell that the DIVs are in. Since the DIVs are on top, or actually in, the table cell, the BGCOLOR of the div is what you see. You would actually need a JS function to do what you want becuase you would have to tell the script which DIV you are on for that link.
As for websites...
http://www.devshed.com/ if pretty good.
_________________________
We need a bigger boat.
|
Top
|
|
|
|
#62632 - 25/01/2002 08:54
Re: Another web authoring question...
[Re: redbutt2]
|
carpal tunnel
Registered: 08/03/2000
Posts: 12341
Loc: Sterling, VA
|
Thanks, I kind of like it now too. I'm not sure we're thinking of the same thing, though. An example of how I wanted the links to work is like on my own site. Is that what you were thinking?
Anyway, I'd be interested in knowing how to fix it just to know. I like how it turned out too. Now to start the finish work on it!
And I can't tell you how cool I think this is. To pull of the same effect with frames would require up to 15 PAGES of HTML (frame page, at least 4 start pages, and all the content pages). This way, I only have ONE. It just boggles my mind
Hehe, you can see I'm excited about it
_________________________
Matt
|
Top
|
|
|
|
#62633 - 25/01/2002 09:06
Re: Another web authoring question...
[Re: Dignan]
|
member
Registered: 12/01/2002
Posts: 141
Loc: San Diego, CA
|
Ahh...I see now. You need the "hover" event in the the CSS set right. Assign a style to the href to keep it from getting confused with the styles in the DIV. See the attached example.
One more thing...Don't use BMP files on web pages. IE is the only browser that can see them. Only use GIF and JPG, and PNG (if you know everyone is using the most current browser).
If you really want to get nuts...there is some insane stuff that you can do to make the DIV contents scroll automatically. There is one other thing, that is PURE CSS that will let you add scroll bars to the DIVs, so that you can actually keep the HTML page the same dimensions no matter how much content there is. It all get pretty fun, but then you have to start asking yourself...when do I stop?
Attachments
61178-CSS_hover.html (139 downloads)
Edited by redbutt2 (25/01/2002 09:15)
_________________________
We need a bigger boat.
|
Top
|
|
|
|
#62634 - 25/01/2002 09:16
Re: Another web authoring question...
[Re: Dignan]
|
member
Registered: 12/01/2002
Posts: 141
Loc: San Diego, CA
|
One more thing...do't use BMP files on the web. Only use GIF and JPG files. Netscape can't see the top image on that page.
_________________________
We need a bigger boat.
|
Top
|
|
|
|
#62635 - 25/01/2002 10:22
Re: Another web authoring question...
[Re: redbutt2]
|
carpal tunnel
Registered: 08/03/2000
Posts: 12341
Loc: Sterling, VA
|
Ah, thanks a lot. I didn't know that about bitmaps. I had gotten tired of how both GIFs and JPGs create artifacts even in white space. Why can't they just keep it the same, pixel for pixel? I would think a whole area of one color would create less space than the same area with a bunch of different shades of that color. Oh well. *edit* hmm, okay this time I saved the bmpas a gif and it turned out allright. I'll see what it gets me with my other files. *edit*
So, uh, mind sharing that code for the scroll bars? I understand what you mean about needing to know when to stop I found that I needed to start restraining myself when I first learned CSS. I wanted to have an effect on EVERYTHING!!! Haha. Anyway, thanks again for the advice. It's very appreciated. Our band president really liked the simplicity that this allowed, and I'm sure band parents will appreciate that as well.
Do you think you could direct me to someplace I can find a way to make an effective password-protected area?
Edited by DiGNAN17 (25/01/2002 10:24)
_________________________
Matt
|
Top
|
|
|
|
#62636 - 25/01/2002 10:55
Re: Another web authoring question...
[Re: redbutt2]
|
carpal tunnel
Registered: 08/03/2000
Posts: 12341
Loc: Sterling, VA
|
Allright, the page is officially online! And I couldn't have done it without ya! Check it out here:
http://www.wm.edu/CAS/music/band/
I think it turned out well. I'm still going to be working on it, but the basics are there and looking good.
_________________________
Matt
|
Top
|
|
|
|
#62637 - 25/01/2002 11:30
Re: Another web authoring question...
[Re: Dignan]
|
member
Registered: 12/01/2002
Posts: 141
Loc: San Diego, CA
|
Scrollbars...
Set the style properties of the DIVs to a defined height and width, then add this property:
overflow:auto
That will force the DIVs to stay the same size. If the content exceeds that size, scrollbars will be added automatically just like an entire IE window.
EX:
style="position:relative; width:350; height:300; overflow:auto"
Something else that you will need to do to make the page look right is set the table cell widths that the DIVs are in to pixels, not %. That way the scrollbar will show up right on the edge of the table. Alternatively, you can leave the width setting out of the style, but I like setting the values absolutely...that way you minimize the wackyness between browser types.
Images:
The secret is pallete choice. For images like the title.gif, GIF is the best choice becauase there aren't a lot of fancy color effects, and limited colors. I attached a new version, where I droped the color pallet to 24 colors vs. the 131 that you saved it with. You'll notice that it looks the same, but the file size is now 3.70KB compared to yours which is 5.43KB. Also, gir GIF, set the "dither" type to diffusion...gives cleaner transitions if the image has gradients.
JPG should be used when you have lots of color depth. JPG is a bit more complicated, but PhotoShop makes it easy and does a really good job of eliminating artifacts. However, there are somethings that you should keep in mind. The higher the compression, the worse the image will look. The band photo could be reduced to about 14k (from 24K). It's all image specific, but you can get really good results if you just play around with the settings.
Thus ends this hours session of Web Site Design with RedButt.
_________________________
We need a bigger boat.
|
Top
|
|
|
|
#62638 - 25/01/2002 11:32
Re: Another web authoring question...
[Re: redbutt2]
|
member
Registered: 12/01/2002
Posts: 141
Loc: San Diego, CA
|
oops forgot to attach the image
Attachments
61221-title2.gif (121 downloads)
_________________________
We need a bigger boat.
|
Top
|
|
|
|
#62639 - 25/01/2002 12:16
Re: Another web authoring question...
[Re: Dignan]
|
member
Registered: 12/01/2002
Posts: 141
Loc: San Diego, CA
|
I forgot to address this question:
>>Do you think you could direct me to someplace I can find a way to make an effective password-protected area?
There is no real EASY way to do this. All "effective" solutions really require you to play with the server a bit. There are JavaScript implementations, but they are hoaky. Basically it involves creating a directory that is the same name as your desired password. Then, you make your form field have a submit function that tries to navigate to the directory with the name of what the user typed in. Like I said, this is hoaky. To make a bullet proof password area, you need to use your server's security files. There is a file called ".htaccess". That file contains permissions for accessing directories. You also specify another file that contains the username/password info.
Here are a few links for you to browse through:
http://faq.clever.net/htaccess.htm
http://www.boycottdaimlerchrysler.com/htaccess.html
And here are some free PERL scripts that will do what you want.
http://www.perlarchive.com/guide/Password_Protection/
There is one other option, but I don't know if your server supports FrontPage. MS FrontPage supports creating protected "Webs". Basically it manages the .htpaccess settings for you, but I would stay away from it.
Edited by redbutt2 (25/01/2002 12:18)
_________________________
We need a bigger boat.
|
Top
|
|
|
|
#62640 - 25/01/2002 12:40
Re: Another web authoring question...
[Re: redbutt2]
|
carpal tunnel
Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
|
PNG is the answer to that problem.
_________________________
Bitt Faulk
|
Top
|
|
|
|
#62641 - 25/01/2002 12:48
Re: Another web authoring question...
[Re: wfaulk]
|
member
Registered: 12/01/2002
Posts: 141
Loc: San Diego, CA
|
Not necissarily. Only newer browsers support PNG files. Granted PNG, gets you good results, but to be platform agnostic, you should stay away form PNG files.
_________________________
We need a bigger boat.
|
Top
|
|
|
|
#62642 - 25/01/2002 12:49
Re: Another web authoring question...
[Re: redbutt2]
|
carpal tunnel
Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
|
True. But it's the best answer there is. GIF is only 8-bit. JPG introduces lots of artifacts into graphics. PNG is the best supported truecolor lossless image format out there.
_________________________
Bitt Faulk
|
Top
|
|
|
|
#62643 - 29/01/2002 13:00
Re: Another web authoring question...
[Re: redbutt2]
|
carpal tunnel
Registered: 08/03/2000
Posts: 12341
Loc: Sterling, VA
|
I thought I was done with this, but apparently not. I finally got around to downloading the latest version of Netscape. To little suprise, I think it sucks. To my amazement, it still can't even handle simple tables correctly. But there's other problems.
The site for my band program is here now, and I think it turned out rather well. In IE, that is. In Netscape it seems that it can't handle the hidden DIVs and just displays them all. This is satisfactory, but not good. (also, Netscape screws up the table on the left. I can't believe it can't even handle cell heights).
So what is it about Netscape that makes it so terrible?
_________________________
Matt
|
Top
|
|
|
|
#62644 - 29/01/2002 20:17
Re: Another web authoring question...
[Re: Dignan]
|
carpal tunnel
Registered: 08/07/1999
Posts: 5549
Loc: Ajijic, Mexico
|
So what is it about Netscape that makes it so terrible?
Probably because you are running the latest version.
I find that I quite like Netscape 4.78, but the newest versions (aren't they up to six-point-something now?) I don't care for at all.
tanstaafl.
_________________________
"There Ain't No Such Thing As A Free Lunch"
|
Top
|
|
|
|
#62645 - 29/01/2002 20:39
Re: Another web authoring question...
[Re: Dignan]
|
old hand
Registered: 28/12/2001
Posts: 868
Loc: Los Angeles
|
The tables are an easy fix. You got to put in blank gif spacers of the correct size, as it compresses empty tables. Sometimes a works too and is easier, but sometimes it doesn't.
Don't know about the Divs offhand, I don't have Netscape installed right now, and am in no hurry to do so.
_________________________
Ninti - MK IIa 60GB Smoke, 30GB, 10GB
|
Top
|
|
|
|
|
|