473,654 Members | 3,098 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What is the right way to use "height:express ion(eval(...)); "

This question was asked in comp.lang.javas cript with no result.

In IE5.x and IE6, I want to display an image when the user rolls over a
text link. The image does indeed display, but only on the first
rollover. It seems that the image height and width become set to zero
after the image is displayed once; or perhaps that the
height:expressi on(eval(...)); code is executed only once for each page
load/reload.

problem demo:

http://www.simple-nude.com/main-2-demo.html

Can some kind soul tell what I need to do to get the image to show up?
Thanks!
-- fredo

Dec 23 '06 #1
8 9258
Aaagghhhh! I misstated the problem. I wrote before:
problem demo:

http://www.simple-nude.com/main-2-demo.html
The REAL problem is this: I need to take the lesser value of (the
intrinsic/auto height of an image) and (100% of the viewport height)
and display an image using that value as the height of the image. The
code is:

-----
// by "this.Heigh t", I mean the intrinsic height of the image I'm
trying to display

height:expressi on(eval(this.He ight <

(document.docum entElement.clie ntHeight!='unde fined' ?
document.docume ntElement.clien tHeight :
document.body.c lientHeight) ?

this.Height :

(document.docum entElement.clie ntHeight!='unde fined' ?
document.docume ntElement.clien tHeight :
document.body.c lientHeight)-50 ));
-----

But the image is always displayed using its intrinsic height. What is
wrong with the test in my code? Thanks!

-- fredo

Dec 23 '06 #2
fredo wrote:
>>
http://www.simple-nude.com/main-2-demo.html
>
But the image is always displayed using its intrinsic height. What is
wrong with the test in my code? Thanks!
I'm no expert on conditional comments but it looks like you've got some
inverted logic on your conditions. Check me:

<!--[if gte IE 5.0]>
<![if lt IE 7]>
[do the fancy tricks, which I did not check]
<![endif]>
<![endif]-->

The first line says If IE 5 or higher. The second line is probably
*supposed* to say If IE lower than v7. But the second line really says
(right?) If NOT IE lower than 7.

From
http://msdn.microsoft.com/workshop/a...omment_ovw.asp
! = The NOT operator. This is placed immediately in front of an value or
expression or feature and reverses the Boolean value of the operand.

Also, it looks like <![endif]is not really the terminator for the
inner condition, because of the missing dashes, but (1) I'm not sure and
(2) I'm not sure if it'd affect your problem.

HTH.
--
John
Dec 23 '06 #3
John Hosking wrote:
fredo wrote:
>
<!--[if gte IE 5.0]>
<![if lt IE 7]>
[do the fancy tricks, which I did not check]
<![endif]>
<![endif]-->
>
Also, it looks like <![endif]is not really the terminator for the
inner condition, because of the missing dashes, but (1) I'm not sure and
(2) I'm not sure if it'd affect your problem.
Okay, I see now that the closing eindif is different for NOTted
conditions, so syntactically, the code is correct. Still think the logic
is wrong though.

--
J.
Dec 23 '06 #4
John Hosking wrote:
fredo wrote:
>
http://www.simple-nude.com/main-2-demo.html
But the image is always displayed using its intrinsic height. What is
wrong with the test in my code? Thanks!

I'm no expert on conditional comments but it looks like you've got some
inverted logic on your conditions. Check me:

<!--[if gte IE 5.0]>
<![if lt IE 7]>
[do the fancy tricks, which I did not check]
<![endif]>
<![endif]-->
the second line really says (right?) If NOT IE lower than 7.
No, because the negation goes with the conditional:

<![if !ltIE7]

and the <! at the front of the conditional statement merely introduces
the production to be parsed.
Also, it looks like <![endif]is not really the terminator for the
inner condition, because of the missing dashes,
It can't have two dashes, because that would look like an HTML comment
terminator, which is not. And cannot be.

Thanks, John. I appreciate your comment and don't at all mean to
terminate it. :-)

-- fredo

Dec 23 '06 #5
Welcome to MAX web Solution's Website, a full service affordable
offshore web site design, Search Engine marketing and web development
company based in Kathmandu. We focus on e business solutions at low
prices serving the needs of small to medium businesses all over the
world. We offer a wide range of custom web site design development and
seo services at affordable prices starting from small presentation
sites to complex multifunctional web portals and advanced custom
e-commerce business solutions.
Service is everything - your satisfaction is guaranteed
That is why we would gladly accept the responsibility of taking care of
your site. We want to save your time, so that you could devote yourself
to the most important thing - your business. Allow us to maintain and
support your web site.
Money back guarantee
A 30 Day money back guarantee for the first monthly fee.
You can also response to this message.

Fillup the below information for further inquarry.
Contact Name :
Organization Name:
E-mail Address :
Phone no:
Call us for Demostration
Call : 2390177 / 9841206820
Check it out for more information
http://www.max-online.biz/idevaffili...ate.php?id=749

Dec 24 '06 #6
Dan
fredo wrote:
In IE5.x and IE6, I want to display an image when the user rolls over a
text link.
And what is it supposed to do in superior browsers such as Mozilla
Firefox?

--
Dan

Dec 26 '06 #7
Dan wrote:
fredo wrote:
In IE5.x and IE6, I want to display an image when the user rolls over a
text link.

And what is it supposed to do in superior browsers such as Mozilla
Firefox?
Superior browsers understand and honor max-height. This hack aims to
get around IE lt 7 max-height deficiency. Mozilla, Firefox, and others
need no such hack. To see FF handle max-height perfectly, see:

http://www.simple-nude.com/demo/css-...ax-height.html

-- fredo

Dec 28 '06 #8
fredo wrote:
<snip>
// by "this.Heigh t", I mean the intrinsic height of the
image I'm trying to display

height:expressi on(eval(this.He ight <

(document.docum entElement.clie ntHeight!='unde fined' ?
document.docume ntElement.clien tHeight :
document.body.c lientHeight) ?

this.Height :

(document.docum entElement.clie ntHeight!='unde fined' ?
document.docume ntElement.clien tHeight :
document.body.c lientHeight)-50 ));
-----

But the image is always displayed using its intrinsic
height. What is wrong with the test in my code?
<snip>

It is difficult to see anything right with your code. First there is -
this.Height -, which evaluates as the - Height - property of the object
referred to by - this -.If - this - reefers to an IMG element's DOM
representation then it would not be expected to have a - Height -
property. The properties of IMG elements that have values corresponding
with the width and height attributes in the HTML mark-up (and may adopt
the dimensions values of the image in some browsers, including IE) are
called 'width' and 'height', with initial lowercase letters. The -
this.Height - reference is likely to evaluate as JScript's Undefined
value, and make a nonsense out of the 'less than' comparison (as it will
always result in what is effectively boolean false).

The call to the - eval - function surrounding the expression is
worthless (and like at least 99.9% of uses of - eval - in
JScritp/javascript code, indicative of an author who has no idea of what
they are doing). If the argument to the - eval - function is not of
string primitive type the - eval - function does nothing, returning its
argument unaltered. Here the argument to - eval - is going to be of
numeric primitive type, or of Undefined Type (though the nonsense that
has been made of the comparison should prevent that). The - eval - call
can be removed form the code with no other adjustments being needed,
making its presence in the code a sure sign that the author did not know
what the -eval - function does, or why it was included in the first
place.

The 'not equal' comparisons (both of them) are also a nonsense. The
comparison is between the value of -
document.docume ntElement.clien tHeight -, which will be numeric on IE
browsers, and the literal string primitive 'undefined'. This mix of
types in the operands is handled by having the operands type-converted
to numeric primitives prior to the comparison and a numeric comparison
performed to determine the boolean result. The string operand,
'undefined', would type-convert to the special numeric value NaN (Not a
Number) as it does not contain a character sequence that can be
interpreted as any number. The numeric NaN value is never equal to any
value, including itself, so the 'not equal' comparisons are always true.

Richard.
Dec 28 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2345
by: Stefan Gangefors | last post by:
I'm trying to figure out what I'm doing wrong when using ereg(). This is my regexp: ereg("^]$", "]"); and that does'n work, but this does: ereg("^$", "[");
5
3151
by: Add and Paste | last post by:
Dear Access developers, I have a lot of cut and pasting to do from Excel to an Access form. But instead of just pasting, I want to "add then paste" the value. Does anybody have a way to do this? Existing code would be appreciated! In other words, I'd like to right click on a form text box and add the value stored in the clipboard to the existing value which is in the text box.
21
13818
by: Helge Jensen | last post by:
I've got some data that has Set structure, that is membership, insert and delete is fast (O(1), hashing). I can't find a System.Collections interface that matches the operations naturally offered by Sets. - ICollection cannot decide containment - IList promises indexability by the natural numbers, which is not achievable (since i hash elements, not sort them). - IDictionary is definatly not setlike. Although I can, of course, define...
2
1572
by: vanvee | last post by:
Hi I have an application, that when a user double clicks a file (that the application creates), the application opens. When the user right clicks a file and selects "Open With", the program icon shows up in the list but the program name is not there (next to the icon). Does anyone know how to make sure that not only the program icon shows up but the program name text as well? Thanks for your help!!
44
9427
by: Viken Karaguesian | last post by:
Hello all, On occasion I want to open hyperlinks (images, etc.) in a new window. In the past, I've used target="_blank" to open the link in a new window. However, using the "target" attribute causes my pages to fail validation (strict doctype). The validator says "There is no attribute 'target'.." So...how do I open a link in a new window, without Javscript, and pass strict validation?
0
1617
by: Jerry Boone | last post by:
I did a lot of searching and found many who said this couldn't be done. After searching I didn't "seem" to turn up anyone who provides this solution. If you posted or found something on this great... but don't nuke me for not hiring a private a2kX investigator to find it. If you are deploying the Runtime of any of these versions of Access you can get the right-click context menu to show the "Filter For: <textbox>" option by doing the...
7
10870
by: the_grove_man | last post by:
How do I invoke a "Right-Click" Programmtically? John
3
1884
by: 30knot | last post by:
is this possible in HTML? If so, what is the code? Thanks, Chris
6
1578
by: =?utf-8?B?4piG4piG4piG4piG4piGIFPDvCBLZWl0aCBDaGFr | last post by:
Ok. Let's say Im writing a game and I have a class table for my character's stats. (Don't worry about classes yet ,you'll run into them soon enough). Say this table includes all his stats, age, strength, charisma, dex, etc.. Say I got ten of these characters running around in my game, and I want to write a function that if they go to the gym and work out they get stronger. Now I have my character John who I make an object of class...
2
1728
by: Tom P. | last post by:
I am writting a extended ListView control and I'd like to stop the default behavior when a user right-clciks on a non-label area and then drags causing a "marching ants" selection box to appear. First, what event is this? And second, how do I stop it? I've trapped the OnItemDrag and OnDragEnter events and it's not them (OnDragEnter doesn't even fire). In OnClick I test for right-click and simply return.
0
8375
marktang
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...
0
8290
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8815
Oralloy
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...
0
8707
jinu1996
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...
1
8482
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7306
agi2029
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...
0
4149
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...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2714
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 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.