473,373 Members | 1,394 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,373 software developers and data experts.

Restrictions on style settings

Claus Mygind
571 512MB
I want to move some style setting into a javaScript function so I can make them variable but I get "invalid assignment left-hand side" error?

see my question at the bottom of this message.

It works fine when I stream it out in my html page like this:
border-style: ridge;
border-width: 5px;
border-color: orange;

The division is made visible via a on screen button which calls this js function:

function showPopSearch( ) {
if ( document.getElementById("popSearch").style.visibil ity == "hidden" ) {
// document.getElementById("popSearch").style.backgro und-color = "#E4BF87";
// document.getElementById("popSearch").style.border-style = "ridge";
// document.getElementById("popSearch").style.border-width = "5px";
// document.getElementById("popSearch").style.border-color = "orange";
document.getElementById("popSearch").style.z-index = "99";
document.getElementById("popSearch").style.visibil ity = "visible";
document.getElementById("pBdataSpan").style.overfl ow = "auto";
document.getElementById("popSearch").style.visibil ity = "hidden";
document.getElementById("pBdataSpan").style.overfl ow = "hidden";

function showGetSearch( ) {
var cHeight = "175";
var cWidth = "450";
var cLeft = parseInt((screen.availWidth/2) - (cWidth/2));
var cTop = parseInt((screen.availHeight/2) - (cHeight/2) - 50);
document.getElementById("popSearch").style.left = cLeft + "px";
document.getElementById("popSearch").style.top = cTop + "px";
document.getElementById("popSearch").style.height = cHeight + "px";
document.getElementById("popSearch").style.width = cWidth + "px";

Question: Why cannot these style parameters be removed from the <STYLE> tag and be placed in the js function?

Please note that when I move them to the js function I remove them from the <STYLE> tag inclusion so they are not duplicated!

document.getElementById("popSearch").style.backgro und-color = "#E4BF87";
document.getElementById("popSearch").style.border-style = "ridge";
document.getElementById("popSearch").style.border-width = "5px";
document.getElementById("popSearch").style.border-color = "orange";

it appears that only the following style settings work for me:
May 28 '08 #1
3 1934
1,654 Expert 1GB
In CSS, if its background-image, in JavaScript, its backgroundImage...

See, all your problem giving code lines contain a style property with a hyphen in it. Remove them and make the immediate next letters capital.
May 28 '08 #2
Claus Mygind
571 512MB

That did the trick as you knew it would

May 28 '08 #3
1,654 Expert 1GB

That did the trick as you knew it would

I knew it would do the trick, but I'm still glad to know that the trick actually helped you.
May 28 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
by: Herbert | last post by:
I'm still relativey new to stylesheets, so I'm hoping that the way I'm going about things can be seriously improved upon, i.e . I just haven't undersood something obvious about the 'cascading'...
by: zmcelrath87 | last post by:
I am having a problem involving the scope of timeouts and intervals. Since timeouts and intervals execute in the global scope, dynamically generated local interval/timeout declarations do not work,...
by: lawrence | last post by:
The following function correctly makes everything invisible but then fails to turn the one chosen DIV back to visible. I imagine I'm getting the syntax of the variable wrong? I've tried this with...
by: lawrence | last post by:
Can anyone tell me why this code works in Netscape 7.1 but not in IE??? <SCRIPT type='text/javascript'> function makeVisible(nameOfDiv) {...
by: seans | last post by:
Hi, I need to change the font, font size, and color of a button on a form. I need to save the current style settings and restore them later. Is there an easy way of doing that? Sorry if there...
by: CLarkou | last post by:
I have 2 signed databases (Microsoft Access MDE) with digital signature in Office 2003. On a client machine (with security HIGH & MEDIUM) one database opens without any problem, the other...
by: Dmitri Shvetsov | last post by:
Hi, Maybe somebody knows why it's happening? I wrote a C# Windows Application working with the remote database through a DataSet. It works cool from my computer but when I gave this...
by: Luciano | last post by:
I have been programing in PHP recently. For this reason, I have lots of basic doubts. Let's see one of then. I'm developing in the localhost, so safety issues are not important. I have a script...
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.