Page 1 of 2

just a little bit of HTML help.

Posted: Thu Jun 16, 2005 3:23 pm
by cobain
A few of you may remember me from the trying to learn C++, but I decided to postpone C++ until I have taken my visual BASIC class this year, hopefully giving me a better understanding of it all. Anyways, this post is because I need help with frames, or maybe iframes, i'm really not sure. My problem is as follows: there is a javascript effect (I already have the script for it) that I would like to confine to one part of a webpage. Well, I tried opening and closing a <body> tag in one cell of a table, and putting hte script in there, but the effect still took up the whole page. Now i'm afraid I must use frames. I only want one frame on the page, and the rest is just tables. I will post the code where I would like the frame.

Code: Select all

<html>
<head>
<title>middle</title>
</head>


<body bottommargin="0" leftmargin="0" marginheiht="0" marginwidth="0" rightmargin="0" topmargin="0">
<table width="738" height="100%" cellpadding="0" cellspacing="0" border="0" align="right">
 <tr>
  <td width="100%" height="221" background="hamm2.jpg">


<!----------here is where i would like a frame that is 738x221------------------------>


  </td>
 </tr>
 <tr>
  <td width="100%" bgcolor="gray">



<font color="black" size="4" align="center">
Does this work?  I sure hope so.
</font>


  </td>
 </tr>
</table>
</body>
</html>
What I want is for the frame to have the background of a picture called "hamm2.jpg", so it will be just like a banner at the top of the page. I am going to put links on top of the 'banner', thats why it needs to be the BG instead of an <img src>. The image can be found at http://img148.echo.cx/img148/5073/hamm24ke.jpg If there is any question as to what i'm trying to accomplish or anything, my Aol Instant Messenger screen name is q3420cobain Thank you,

Cobain

Posted: Thu Jun 16, 2005 5:23 pm
by JS Lemming
Yeah, I seriously don't know what you're attempting. Noteworthy advice, stay away from frames... including iFrames. There is always a better way.

Posted: Thu Jun 16, 2005 11:24 pm
by cobain
I'm sorry I wasn't very clear. I was trying to confine a javascript effect to just one small part of a page, a snowing effect (for a christmas page). I tried everything that I could think of to do this, and everyone kept telling me frames are the only way. I hate frames as well, but... I may just abandon the idea, I really dont know how to explain it any better. Sorry, anyways, nice talking to you lemming. See ya.

Posted: Fri Jun 17, 2005 5:30 pm
by JS Lemming
If you post the JS code, maybe I can tweak it to only work in span or div tags, giving the same effect without frames.

Posted: Sat Jun 18, 2005 10:46 am
by cobain
You know javascript? Cool. Anywho, here is the code:

Code: Select all

<script>
// CREDITS:
// Snowmaker Copyright (c) 2003 Peter Gehrig. All rights reserved.
// Distributed by http://www.hypergurl.com
// Permission given to use the script on webpages provided that this notice remains as is.

// Set the number of snowflakes (more than 30 - 40 not recommended default 35)
var snowmax=30

// Set the colors for the snow. Add as many colors as you like
var snowcolor=new Array("#aaaacc","#ddddFF","#ccccDD")

// Set the fonts, that create the snowflakes. Add as many fonts as you like
var snowtype=new Array("Arial Black","Arial Narrow","Times","Comic Sans MS")

// Set the letter that creates your snowflake (recommended:*)
var snowletter="*"

// Set the speed of sinking (recommended values range from 0.3 to 2 default 0.6)
var sinkspeed=2
// Set the maximal-size of your snowflaxes
var snowmaxsize=25

// Set the minimal-size of your snowflaxes
var snowminsize=5

// Set the snowing-zone
// Set 1 for all-over-snowing, set 2 for left-side-snowing 
// Set 3 for center-snowing, set 4 for right-side-snowing
var snowingzone=1

///////////////////////////////////////////////////////////////////////////
// CONFIGURATION ENDS HERE
///////////////////////////////////////////////////////////////////////////


// Do not edit below this line
var snow=new Array()
var marginbottom
var marginright
var timer
var i_snow=0
var x_mv=new Array();
var crds=new Array();
var lftrght=new Array();
var browserinfos=navigator.userAgent 
var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/)
var ns6=document.getElementById&&!document.all
var opera=browserinfos.match(/Opera/)  
var browserok=ie5||ns6||opera

function randommaker(range) {		
	rand=Math.floor(range*Math.random())
    return rand
}

function initsnow() {
	if (ie5 || opera) {
		marginbottom = document.body.clientHeight
		marginright = document.body.clientWidth
	}
	else if (ns6) {
		marginbottom = window.innerHeight
		marginright = window.innerWidth
	}
	var snowsizerange=snowmaxsize-snowminsize
	for (i=0;i<=snowmax;i++) {
		crds[i] = 0;                      
    	lftrght[i] = Math.random()*15;         
    	x_mv[i] = 0.03 + Math.random()/10;
		snow[i]=document.getElementById("s"+i)
		snow[i].style.fontFamily=snowtype[randommaker(snowtype.length)]
		snow[i].size=randommaker(snowsizerange)+snowminsize
		snow[i].style.fontSize=snow[i].size
		snow[i].style.color=snowcolor[randommaker(snowcolor.length)]
		snow[i].sink=sinkspeed*snow[i].size/5
		if (snowingzone==1) {snow[i].posx=randommaker(marginright-snow[i].size)}
		if (snowingzone==2) {snow[i].posx=randommaker(marginright/2-snow[i].size)}
		if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4}
		if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2}
		snow[i].posy=randommaker(2*marginbottom-marginbottom-2*snow[i].size)
		snow[i].style.left=snow[i].posx
		snow[i].style.top=snow[i].posy
	}
	movesnow()
}

function movesnow() {
	for (i=0;i<=snowmax;i++) {
		crds[i] += x_mv[i];
		snow[i].posy+=snow[i].sink
		snow[i].style.left=snow[i].posx+lftrght[i]*Math.sin(crds[i]);
		snow[i].style.top=snow[i].posy
		
		if (snow[i].posy>=marginbottom-2*snow[i].size || parseInt(snow[i].style.left)>(marginright-3*lftrght[i])){
			if (snowingzone==1) {snow[i].posx=randommaker(marginright-snow[i].size)}
			if (snowingzone==2) {snow[i].posx=randommaker(marginright/2-snow[i].size)}
			if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4}
			if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2}
			snow[i].posy=0
		}
	}
	var timer=setTimeout("movesnow()",50)
}

for (i=0;i<=snowmax;i++) {
	document.write("<span id='s"+i+"' style='position:absolute;top:-"+snowmaxsize+"'>"+snowletter+"</span>")
}
if (browserok) {
	window.onload=initsnow
}
</script>
If its much trouble at all to tweak it to work indide some kind of specific tag, dont worry about it. But if not, then thanks! And Gyro, Arce said he asked you to delete this topic (i asked him to ask you a day or two ago.) But JS replied, so could you leave it for awile longer? Sorry for being an inconvience if I am being one. See ya

Posted: Sat Jun 18, 2005 1:31 pm
by Falco Girgis
Yeah, I won't delete it.

Posted: Sat Jun 18, 2005 3:11 pm
by MarauderIIC
Why would it be deleted? It's a perfectly valid -- and educational -- topic. Anyway, back on subject!

Posted: Sat Jun 18, 2005 3:24 pm
by Falco Girgis
MarauderIIC wrote:Why would it be deleted? It's a perfectly valid -- and educational -- topic. Anyway, back on subject!
It seems like I've gotten several PMs about people asking to delete topics before.

That's not how a forum works. Just because a topic is over, it isn't destroyed or deleted. That's part of a community. What happens if somebody has a similar question or something in the future? They can use the search button (many of you aren't smart enough to know it exists though) and find it.

Posted: Sat Jun 18, 2005 3:32 pm
by JS Lemming
I attempted to "write" the snow particles to a specified ID. But it kept spewing errors. Sorry, no dice this time.

Posted: Sat Jun 18, 2005 10:59 pm
by cobain
Thats okay, I'll just drop the idea. It was just a little add-on, but it doesn't really matter. Thanks for trying! Oh, and hey, while I got a topic running: The guy I'm making the webpage for specifically asked me if there is a way to see how many people have visited the page. Well, I know how to on most hosts, but I'm now trying one called byethost, and I can't seem to find the stats. Is there a JS effect (possibly even using a little bit of PHP) That would tell me how many hits I have, and maybe even how many individual hits? (for each IP, it only counts it once no matter how many times they go) Oh yeah, maybe it could record it in some file set file on the server. I don't want a counter at the bottom of the page because alot of times they are inaccurate, and it wouldn't exactly fit the page. Also, I have lets seee...its either 1 or 5 free SQL domains at my disposal, can't remember which. Anywho, if anything comes to mind, like a script that you know of or something, I would appreciate it, but if not thats coo too.

Posted: Sun Jun 19, 2005 1:40 am
by Falco Girgis
Javascript isn't going to help for crap there. Javascript is a client side scripting language. It can't interact with the server (which you'd need to do to record the visits.)

You'd need to turn to the power of server side scripting. Perl and PHP are the two most common. Also, no webhost has a certain "way" to do it, they just have scripts pre-installed to do the dirty work for you. It's not an effect, it's something that has to be programmed.

You can find free status scripts of insane quality about anywhere. Both Perl and PHP should have extensive selections. Just give Google a try. :D

Posted: Sun Jun 19, 2005 8:53 am
by JS Lemming
Just don't buy a script!!! As gyrovorbis says, high quality can be free.

Posted: Sun Jun 26, 2005 2:46 pm
by cobain
Thanks for the advice, I didn't pay for a script. While I have this HTML topic running, I have another question: just why are frames so terrible? I have heard that from every person that is good with HTML, including JS in some posts on this thread. I personally don'y use frames, I always use tables instead. I was just wondering why so many people hate frames so much...

Posted: Tue Jul 05, 2005 3:14 pm
by MarauderIIC
They aren't really consistent enough from browser to browser. A table will usually get the job done fine.

Posted: Tue Jul 05, 2005 4:16 pm
by cobain
Is it possible to open a body tag within a body tag?
What about head tags, possibly to site another style sheet? For body, would you have to close the one that is currently open, open a new one, close that one, then open back up a copy of the origional one, then close it to finish with? Thanks!