Hi
I am working on a project (for college) and wondered if anyone can help me with my problem. In the project we are not allowed to make use of any "style" attributes but "class" attributes instead. The following is the java script that i am using and i am having trouble in using a class instead of a style tag because simply replacing the style=\"positio n:absolute;\" tag with class=\"posiAbs \" where in the external css ".posiAbs {position:absol ute;} doesn't work. I am very new to this stuff so if anyone has some advice I would really appreciate it.
NOTES: This script only has to be compatible with Internet Explorer JAVA SCRIPT -
var titlea = new Array();
-
var texta = new Array();
-
var heightarr = new Array();
-
-
titlea[0] = "<img src=\"doggie3.jpg\"> Dog Fact #1";
-
texta[0] = "It is a myth that dogs are color blind. They can actually see in color, just not as vividly as humans. It is akin to our vision at dusk.";
-
-
titlea[1] = "<img src=\"doggie3.jpg\"> Dog Fact #2";
-
texta[1] = "Dogs DO have better low-light vision than humans because of a special light-reflecting layer behind their retinas ";
-
-
titlea[2] = "<img src=\"doggie3.jpg\"> Dog Fact #3";
-
texta[2] = " A German Shepherd guide dog led her blind companion the entire 2100 mile Applachian Trail ";
-
-
titlea[3] = "<img src=\"doggie3.jpg\"> Dog Fact #4";
-
texta[3] = "If never spayed or neutered, a female dog, her mate, and their puppies could product over 66,000 dogs in 6 years! ";
-
-
var mc=4;
-
-
var inoout=false;
-
var tmpv;
-
tmpv=180-8-8-2*parseInt(1);
-
var psy = new Array();
-
divtextb ="<div id=d";divtextb2 ="<div id=dz";divtev1=" onmouseover=\"pauseScroller(";divtev2=")\" onmouseout =\"restime(";divtev3=")\" ";divtev4="";divtexts = " style=\"position:absolute;visibility:hidden;width:"+tmpv+"; COLOR: #000000; left:0; top:0; FONT-FAMILY: MS Sans Serif,arial,helvetica; FONT-SIZE: 10pt; FONT-STYLE: normal; FONT-WEIGHT: normal; TEXT-DECORATION: none; margin:0px; overflow-x:hidden; LINE-HEIGHT: 12pt; text-align:left;padding:0px; cursor:'default';\">";ie6span= " style=\"position:relative; COLOR: #5700AE; width:"+tmpv+"; FONT-FAMILY: verdana,arial,helvetica; FONT-SIZE: 11pt; FONT-STYLE: normal; FONT-WEIGHT: bold; TEXT-DECORATION: none; LINE-HEIGHT: 14pt; text-align:left;padding:0px;\"";uzun="<div id=\"enuzun\" style=\"position:absolute;\">";
-
uzun2="<div id=\"enuzun2\" style=\"position:absolute;left:0;top:0;\">";
-
var thetop=0;
-
var toplay=0;
-
-
function pauseScroller(gnum,gnum5) {
-
inoout=true;
-
objd=eval("d"+gnum);
-
objd2=eval("hgd"+gnum);
-
window.status="The Coolest Dog Facts in Town!!!!! :-)";
-
}
-
-
function restime(gnum2,gnum5) {
-
inoout=false;
-
if(gnum5==1) {
-
objd=eval("dz"+gnum2);
-
objd2=eval("hgdz"+gnum2);
-
} else {
-
objd=eval("d"+gnum2);
-
objd2=eval("hgd"+gnum2);
-
}
-
objd.style.color="#000000";
-
objd2.style.color="#5700AE";
-
window.status="";
-
}
-
-
function dotrans() {
-
if(inoout==false) {
-
theTop--;
-
if(theTop<(-1*toplay)) {
-
theTop=0;
-
enuzun2.style.pixelTop=400;
-
}
-
enuzun.style.pixelTop=theTop;
-
if((theTop+toplay)<400) {
-
enuzun2.style.pixelTop=theTop+toplay;
-
}
-
}
-
if(psy[(theTop*(-1))+4]==3) {
-
setTimeout('dotrans()',3000+35);
-
} else {
-
setTimeout('dotrans()',35);
-
}
-
}
-
-
function scroller2() {
-
for(i=0;i<mc;i++) {
-
objd=eval("d"+i);objd2=eval("dz"+i);
-
if((parseInt(objd.offsetHeight)<=0)||(parseInt(objd2.offsetHeight)<=0)) {
-
setTimeout('scroller2()',1000);return;
-
}
-
}
-
i=0;
-
for(i=0;i<mc;i++) {
-
objd=eval("d"+i);
-
heightarr[i]=parseInt(objd.offsetHeight);
-
}
-
toplay=4;
-
for(i=0;i<mc;i++) {
-
objd=eval("d"+i);objd2=eval("dz"+i);
-
objd.style.visibility="visible";
-
objd2.style.visibility="visible";
-
objd.style.pixelTop=toplay;
-
objd2.style.pixelTop=toplay;
-
psy[toplay]=3;
-
toplay=toplay+heightarr[i]+10;
-
}
-
enuzun.style.left=8+"px";
-
enuzun.style.height=toplay+"px";
-
enuzun.style.width=tmpv+"px";
-
enuzun.style.top=400+"px";
-
enuzun2.style.left=8+"px";
-
enuzun2.style.height=toplay+"px";
-
enuzun2.style.width=tmpv+"px";
-
enuzun2.style.top=400+"px";
-
theTop=400;
-
dotrans();
-
}
-
-
function scroller() {
-
i=0;
-
innertxt=""+uzun;
-
for(i=0;i<mc;i++) {
-
innertxt=innertxt+""+divtextb+""+i+""+divtev1+i+",0"+divtev2+i+",0"+divtev3+i+divtev4+divtexts+"<span id=\"hgd"+i+"\""+ie6span+">"+titlea[i]+"</span><br>"+texta[i]+"</div>";
-
}
-
innertxt=innertxt+"</div>";
-
innertxt=""+innertxt+uzun2;
-
for(i=0;i<mc;i++) {
-
innertxt=innertxt+""+divtextb2+""+i+""+divtev1+i+",1"+divtev2+i+",1"+divtev3+i+divtev4+divtexts+"<span id=\"hgdz"+i+"\""+ie6span+">"+titlea[i]+"</span><br>"+texta[i]+"</div>";
-
}
-
innertxt=innertxt+"</div>";spageie.innerHTML=""+innertxt;setTimeout('scroller2()',500);
-
}
-
window.onload=scroller;
-
HTML PAGE:
[html]
<html>
<head>
<title>
</title>
</head>
<body bgcolor="#8080F F">
<div id="disspageie" >
<div id="spageie">
</div>
</div>
<script language="javas cript">
document.write( "<script language=\"java script\" src=\"navigatio nBarScrollerJav aScript.js\"></scr"+"ipt>");
</script>
</body>
</html>
[/html]
3 1921
Well, at least it will not work in a browser that is not IE, which seems to be the idea.
Any style assignment you make in a class in a stylesheet will work exactly like an inline style, but classes are trumped by inline styles, by more specific selectors in the cascade, and by any user stylesheet declarations.
You could try making your classes more specific, targetting element tags as well as classnames, but really specific classes could be set on id selectors.
I'm pretty sure the issue is properly inserting the styling using javascript, so this is a javascript question and I'm sending it there.
btw, JavaScript is one word, not two, and totally unrelated to Java.
acoder 16,027
Recognized Expert Moderator MVP
I am working on a project (for college)...
NOTES: This script only has to be compatible with Internet Explorer
A bit off-topic, but is that what they're teaching you?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Penn Markham |
last post by:
Hello all,
I am writing a script where I need to use the system() function to call
htpasswd. I can do this just fine on the command line...works great
(see attached file, test.php). When my webserver runs that part of the
script (see attached file, snippet.php), though, it doesn't go through.
I don't get an error message or anything...it just returns a "1"
(whereas it should return a "0") as far as I can tell. I have read the
PHP...
|
by: Dynamo |
last post by:
Hi again,
Having had a little experience of HTML and style classes but only a limited
knowledge of PHP perhaps somebody can tell me the pros and cons of the
following.
Surely if I write something in PHP like
$style = "<b><i><font size='1'>"
$endstyle ="</b></i></font>"
|
by: Fred Zilz |
last post by:
I am trying to use an external style sheet to create a round cornered
box. I am have difficulties correctly referencing my class in my
style sheet. I am posting an excerpt from my style sheet:
<code>div.prodlinks {font-family:Aria; float:right;
vertical-align:top; font-size:10px; background-color:#efbc24; }
div.prodlinks h1 {font-weight:bold; text-decoration:none;
font-size:12px;font-family:Arial;margin: 0 10px;...
|
by: Xah Lee |
last post by:
what does it mean when a style tag gives something like the following?
<style type="text/css" media="screen,projection">/*<!]>*/</style>
is this standard?
Xah
xah@xahlee.org
∑ http://xahlee.org/
|
by: anupamjain |
last post by:
Hi,
After 2 weeks of search/hit-and-trial I finally thought to revert to
the group to find solution to my problem.(something I should have done
much earlier)
This is the deal :
On a JSP page, I want to grab a URL and parse /change the HTML and send
it to the JSP page. I take the URL from the user in a textbox (not the
| |
by: fishwick |
last post by:
I haven't really done any css in quite a while, and am banging my head
against the wall trying get the rudimentary layout together of a church
website home page to display correctly - I don't want to continue work
until I understand what I'm doing wrong.
http://www.christchurchinfo.net
The site displays nicely in Firefox/Mozilla and Safari, but the stained
glass windows navigation portion is getting pushed down in IE, and the
"news"...
|
by: John Dalberg |
last post by:
I am using an application that dynamically creates style tags all over the
place in the html file. I mean some inside the head section and some in the
body section. I have no control over this.
Is there a tool/utility out there which reads in such a file, moves all the
STYLE tags and groups them together in the head section or an external
file? (Just grouping them is fine with me)
John Dalberg
|
by: Dawgs9604 |
last post by:
I am trying to get a floating center table. I have tables on the left and right, but I am having troubles in particular with my center and right floating boards. I have set the width the boards are supposed to be, however the right forum feels the need to size itself to a much wider forum, same with the middle forum, and because of these I cannot manage to get them to fit neatly beside eachother
This is my code defining the size of the...
|
by: matheussousuke |
last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails.
The goal is: Make it send the email with the URL http://mghospedagem.com/images/controlpanel.jpg
instead of
http://mghospedagem.comhttp://mghospedagem.com/images/controlpanel.jpg
As u see, there's the website URL before the image URL.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |