PDA

View Full Version : script in css document? Please read


akalsha
09-08-2002, 02:45 PM
Hi all.
I have a simple javascript that goes in the head of an HTML document that looks like this:

<script language="JavaScript">
if (parent.location.href == self.location.href){
window.location.href = '/pink/ndmain.html'
}
</script>

I want to put this on all the pages of my web site. I currently have an externally linked .css document on all my pages:

<style type="text/css">
<!--

BODY {
background-attachment: fixed; background-image: url(/st/pagebackgrounds.jpg);
scrollbar-face-color: #ffffff;
scrollbar-shadow-color: #FFF48F;
scrollbar-highlight-color: #A6B6FF;
scrollbar-3dlight-color: #A6B6FF;
scrollbar-darkshadow-color: #FFF48F;
scrollbar-track-color: #ffffff;
scrollbar-arrow-color: #A6B6FF
}

-->

I would like to know if it is possible to add the script to the css document? Basically I'm trying to avoid going in and adding the script to all the pages.

Mr J
09-08-2002, 02:57 PM
Unfortunately it looks like you have a bit of work ahead of you especially if you have a lot of files on your site.

I feel for you because I have been there quite a few times myself.

.CSS and .JS are, as you guess, different in so far as they do totally different things.


I am though puzzled to the javascript that you are going to use




<script language="JavaScript">
if (parent.location.href == self.location.href){
window.location.href = '/pink/ndmain.html'
}
</script>



I am almost positive in saying that the only page your ever going to see is ndmain.html if you put that script in all your pages.

Still...........................might be wrong

akalsha
09-08-2002, 03:01 PM
Ya, I figured that, but I though if anyone would know it would be someone here. Oh well, looks like I have some work ahead of me lol

The script is a "stay in frames" script. It keeps people from loading the web site pages without the frame. :D

brothercake
09-08-2002, 05:02 PM
Put the script in an external js file:

<script language="JavaScript" src="external.js"> </script>



Then external.js would be:

if (parent.location.href == self.location.href){
window.location.href = '/pink/ndmain.html'
}