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 August 3rd, 2005, 07:08 AM
Authorized User
 
Join Date: Jul 2005
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default from javascript to css

I need to change this javascript into a css file and make it function like it is now but I don't want to have javascript enabled on the web browser. Can someone help me?

<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="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
</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
</select>
<input type="button" value="Change Text color" name="myButton3" onClick="change()" />
</form>

Reply With Quote
  #2 (permalink)  
Old August 4th, 2005, 12:11 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Why do you need to change this to CSS? From the looks of it JavaScript is exactly what you need. JavaScript handles interaction based on user initiated events. CSS handles styling and presentation. Sometimes CSS can do interaction, for instance when a user's mouse comes over an element, it can be changed stylistically. It, OTOH, does not do "onclick" events and the like, that is scripting, and it should remain scripting. Why the JavaScript taboo?


Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
Reply With Quote
  #3 (permalink)  
Old August 8th, 2005, 09:39 AM
Authorized User
 
Join Date: Jul 2005
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I need a css file or files. I was not allowed to use javascript and I did, I have a script that shows that I'm trying to accomplish. I don't have any experience with css files right now.

Reply With Quote
  #4 (permalink)  
Old August 8th, 2005, 02:44 PM
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

Quote:
quote:I was not allowed to use javascript
Out of curiosity: why not? Who said you're not allowed to do this?

It feels it but odd to require someone to do something like this without allowing them to use the right tools. It's like asking someone to take down a tree and take away their saw....

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
How to access CSS using JavaScript? Gary Frank Javascript How-To 2 February 28th, 2008 01:32 PM
replace css with javascript Maxxim CSS Cascading Style Sheets 11 October 7th, 2007 02:29 PM
JavaScript, CSS, DOM - xBrowser Problem erobb Javascript 1 September 10th, 2006 06:44 AM
external CSS in JavaScript code webdesign Javascript 1 September 1st, 2006 04:35 PM
from javascript to css jstewie Javascript How-To 0 August 3rd, 2005 07:09 AM



All times are GMT -4. The time now is 11:37 AM.


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