SiteExperts.com Logo Home | Community | Developer's Paradise
User Groups | Site Tools | Site Information | Search
 Main Menu
 Forums
SiteExperts.com Forums
All Discussions

SiteExperts Feedback
The Lounge
Dynamic HTML
Site Design/ Critiques
HTML and CSS
XML Technologies
The Wireless Internet
Internet Explorer
Microsoft .NET
The Server
Technical Support

Sponsored Links

User Groups : Forums : SiteExperts : Dynamic HTML :

Previous DiscussionNext Discussion
 Call js function from CSS

I am redesigning my robin-ann.com website :) First, lQQk here: http://www.robin-ann.com/dev/ra  

The premise of this excercise is that I read a great article on designing for 1024 screen widths (allowing of course for smaller/larger with a fluid design) and well - now that I've done that, my giant images at the top of the screen blow past my margins set for the CSS 'header' declaration.

My thought to solve this was to place a div with a bg image on top of the above-mentioned div and give it an auto or 100% width to allow for resizing the 'header' - now all my backgrounds fit, right?!

Here's the catch: I have a script which throws a random image in that space and I want to keep running it - only I do not know how to accomplish this feat properly. I remember oogling at hedger's various css calling js, so I imagine it can be done and here's a good quote I read the other day from a google webinar : "Simple things should be simple, complex things should be possible."

This is what I tried:

1)calling the js file from the index:
   <script type='text/javascript' src='iwantmorepictures.js'> </script>


2)Then placing this in the CSS file:
   #headerForground {background:url("javascript:showImage();") width:auto; height:250px; }

Take a look here: http://www.robin-ann.com/dev/ra/javascript_test.html - IE makes it show JUST the image, which makes sense since the function says

document.write('<img src="'+theImages[whichImage]+'">');
and well - I don't exactly want my whole page in that line, so is there a way around that...? I do not understand Mozilla's interpretation of what I did in DOM at all! :( 

I enjoy javascript very much but always have a bit of trouble running it properly. Can someone provide me the way to run the <code>showImage();</code> from the css file... ?

Here is my mind at work...
<div class="OuterBG-nojs"><!--Just the "Turn on Javascript FOO!" image-->
 <div class="OverlayBG-withjs"><!--the javascript function in the css background -->
 </div>
</div> <!--
Should be this simple eh?-->

Started By RobinAnn on Sep 18, 2006 at 12:04:36 PM

35 Response(s) | Reply

View All Replies | Goto Page: 5 4 3 2 1
MHenke on Oct 2, 2006 at 5:09:28 AM

> Users should not run any code, be that bookmarklets or executables, they do not understand and/or can not trust.
Users should not run computers, anyway...  8)


View All Replies | Goto Page: 5 4 3 2 1

To respond to a discussion, you must first logon.

If you are not registered, please register yourself to become a member of the SiteExperts.community.

User Name
Password
Copyright 1997-2000 InsideDHTML.com, LLC. All rights reserved.