Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > CSS > CSS Cascading Style Sheets
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
CSS Cascading Style Sheets All issues relating to Cascading Style Sheets (CSS).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the CSS Cascading Style Sheets section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 21st, 2005, 07:31 AM
Authorized User
 
Join Date: Jul 2005
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default How do I make this script into a css file? - Backg

How do I make this script into a css file? And make everything work just as it is in javascript?

<script type="text/javascript">
function SelectSize()
{
var dropDown=document.getElementById("size");
var SelectedSize = dropDown.options[dropDown.selectedIndex].value;
document.body.style.fontSize=SelectedSize + "px";
}
</script>
<form name="frmcontrol">
<select id=size onChange="SelectSize()" >
<option value="20">Default
<option value="12">Very Small
<option value="18">Smaller
<option value="26">Medium
<option value="36">Bigger
<option value="48">Larger
<option value="72">Very Large
</select>
<input type="button" value="Change Size of Text" name="myButton" onClick="SelectSize()" />
</form>

<script language="javascript">

function colorChange()
{
document.bgColor=document.list.colors.options[document.list.colors.selectedIndex].value;
}
</script>
<form name="list">
<select name="colors">
<option value="006633">Default
<option value="black">Black
<option value="white">White
<option value="yellow">Yellow
<option value="red">Red
<option value="blue">Blue
<option value="green">Green
</select>
<input type="button" value="Change Background color" name="myButton2" onClick="colorChange()" />
</form>

<BODY bgColor=#006633>

<script language="javascript">

function change()
{
document.fgColor=document.text.color.options[document.text.color.selectedIndex].value;
}
</script>
<form name="text">
<select name="color">
<option value="black">Default
<option value="black">Black
<option value="white">White
<option value="yellow">Yellow
<option value="red">Red
<option value="blue">Blue
<option value="green">Green
</select>
<input type="button" value="Change Text color" name="myButton3" onClick="change()" />
</form>

Reply With Quote
  #2 (permalink)  
Old July 21st, 2005, 07:37 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

What do you mean by "make this script into a css file"? What are you trying to accomplish?

JavaScript and CSS are two quite different technologies, although they mix well. Your question is like "How do I change this pick up truck into a shopping cart".... ;)

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #3 (permalink)  
Old July 21st, 2005, 08:08 AM
Authorized User
 
Join Date: Jul 2005
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Forget my first question, I just want to be able to link the javascript on to every page, how do I do that?

and it's in "asp format now" I can't cut and paste to every asp page, I don't have that kind of space.

Reply With Quote
  #4 (permalink)  
Old July 21st, 2005, 08:13 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Normally, you can link a JavaScript file like this:

<script type="text/javascript" src="/YourScript.js"></script>

However, this file also includes HTML so you'll need to add it to the <body> of the page. If you're using ASP, your best bet is to use a server side include.

Move your code to a new .asp file and then include it where you need it like this:



where YourInclude.asp is your file with the code and Includes is a sub folder in your site.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make the tilde work on script element hpox ASP.NET 2.0 Basics 10 February 14th, 2011 03:00 PM
How do I make a Help File? chobo2 C# 2005 1 November 13th, 2007 05:36 AM
The css file in my website gets disabled Mags VS.NET 2002/2003 3 March 27th, 2007 06:46 PM
What is CSS File in .NET ? anujrathi SQL Server 2000 1 May 7th, 2006 10:56 AM
how do i make a script run in background LIMONADA VBScript 6 April 25th, 2006 11:21 AM



All times are GMT -4. The time now is 10:32 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.