473,385 Members | 1,387 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,385 software developers and data experts.

clip in Opera

Hello,

I've just downloaded and installed Opera711, good browser. Most of my
scripts work just fine, except the ones that use "clip" property. Opera
docs say that it's supported but I can't get it to work. It seems that
clip is some kind of object (some kind of rect?) but I'm unable to read
it's properties, only
methods. It has only one method "replace". Can you tell me what's going
on there? And why can't I read properties of objects with the function
below?
----------------------------------------
<HTML><HEAD><TITLE></TITLE>
<script type="text/javascript">
function getClip(o){
var c = o.style.clip;
//document.zz.qq.value = objProps(c, 'o');
//document.zz.qq.value = objProps(o, 'o');
document.zz.qq.value = objProps(o.style, 'o');
}
function objProps(obj, name){
var str = "";
for (var i in obj)
str += name + '.' +i+ '=' +obj[i]+ '\n';
return str;
}
function s(){
this.h = "k";
}
</script>
</HEAD><BODY>

<DIV ONCLICK="getClip(this)"
STYLE="position:absolute; top:0; left:0; width:100; height:50">Get
Clip</DIV>

<FORM NAME="zz" ACTION="" METHOD="">
<TEXTAREA NAME="qq" COLS=65 ROWS=15></TEXTAREA>
</FORM>
</BODY></HTML>
-----------------------------------
TIA,
Roman
Jul 20 '05 #1
2 1979

<roman@nomail> schreef in bericht
news:c4********************************@4ax.com...
Hello,

I've just downloaded and installed Opera711, good browser. Most of my
scripts work just fine, except the ones that use "clip" property. Opera
docs say that it's supported but I can't get it to work. It seems that
clip is some kind of object (some kind of rect?) but I'm unable to read
it's properties, only
methods. It has only one method "replace". Can you tell me what's going
on there? And why can't I read properties of objects with the function
below?


There isn't such thing as a default clip property, so you will have to set
it if you want to use it:

function getClip(o){
var c = o.style.clip;
if (c) alert(c); else alert('Not set');
}
....
<DIV ONCLICK="getClip(this)"
STYLE="position:absolute; top:0; left:0; width:100; height:50;
clip:rect(auto,auto,auto,auto)">Get
Clip</DIV>
JW

Jul 20 '05 #2
DU
roman@nomail wrote:
Hello,

I've just downloaded and installed Opera711, good browser. Most of my
scripts work just fine, except the ones that use "clip" property. Opera
docs say that it's supported but I can't get it to work.
There are a few bugs. One well known in Opera 7.x is that the background
(image, color) is not clipped, only content.

It seems that clip is some kind of object (some kind of rect?) but I'm unable to read
it's properties, only
methods.
clip is a property. The only shape supported is rect.

It has only one method "replace".

?

Can you tell me what's going on there? And why can't I read properties of objects with the function
below?
----------------------------------------
<HTML><HEAD><TITLE></TITLE>
<script type="text/javascript">
function getClip(o){
var c = o.style.clip;
//document.zz.qq.value = objProps(c, 'o');
//document.zz.qq.value = objProps(o, 'o');
document.zz.qq.value = objProps(o.style, 'o');
Opera 7.20 beta now supports getComputedStyle and getComputedValue.
Your getClip function is not best I think. I would have been using
currentStyle for IE instead of style... if you want to get the default
css declarations of existing elements.
}
function objProps(obj, name){
var str = "";
for (var i in obj)
str += name + '.' +i+ '=' +obj[i]+ '\n';
return str;
}
function s(){
this.h = "k";
}
</script>
</HEAD><BODY>

<DIV ONCLICK="getClip(this)"
STYLE="position:absolute; top:0; left:0; width:100; height:50">Get
Clip</DIV>

Invalid CSS code.
"a unit must be specified for length values"
http://www.w3.org/TR/CSS2/syndata.html#parsing-errors

" The format of a length value (denoted by <length> in this
specification) is an optional sign character ('+' or '-', with '+' being
the default) immediately followed by a <number> (with or without a
decimal point) immediately followed by a unit identifier (e.g., px, deg,
etc.)."
http://www.w3.org/TR/CSS2/syndata.html#value-def-length

Your getClip function should be coded in a way that it should return
rect(auto auto auto auto)
or
rect(auto,auto,auto,auto)
in any DOM2 and CSS2 compliant browser.
<FORM NAME="zz" ACTION="" METHOD="">
<TEXTAREA NAME="qq" COLS=65 ROWS=15></TEXTAREA>


It's always better to quote attribute values as it speeds up a bit
parsing and rendering and it avoids errors of all kinds in all sorts of
situations.

http://www.htmlhelp.com/faq/html/basics.html#quotes
http://www.html-faq.com/htmlvalidation/?quoteattributes
Why attribute values should always be quoted in HTML
http://www.cs.tut.fi/~jkorpela/qattr.html

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html

Jul 20 '05 #3

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

Similar topics

2
by: Alex NSB | last post by:
Hi all. Consider the following page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML><HEAD><TITLE>Test</TITLE> <STYLE...
3
by: Roderik | last post by:
Hi, Is it possible to clip a layer (height 5px, width: 780px) to the bottom of the viewport using CSS? regards, Roderik -- http://www.archytas.nl/
0
by: Matt Kruse | last post by:
I'm making changes to an intranet web app that uses only IE6 as the browser. It makes use of CSS expressions for dynamic positioning and other tricks, and it works quite well. My question is:...
15
by: Anand Ganesh | last post by:
HI All, I have an Image. I want to clip a portion of it and copy to another image. How to do this? I know the bounding rectangle to clip. Any suggestions please. Thanks for your time and...
6
by: queisser | last post by:
Hi all, I'm writing a C# app that uses copy/paste to put graphics in a window. My copy/paste logic first looks for Metafile, then for bitmap. Here's the problem: when I copy and paste a WMF...
1
by: Cylix | last post by:
In CSS: clip: px|% px|% px|% px|% How can I set it in javascript? I have tried x.style.clip.top, x.style.clip.left ... However, it seems no effect.
5
cameokid
by: cameokid | last post by:
Can someone help me out with this. Here is what i am trying to do. I have an image of size 310x310. Initially i am displaying only 50x50 using clip property. Later using setTimeout property i am...
29
by: Chris Riesbeck | last post by:
I have an image with a class and the class defines a clip rectangle. In Firefox 2 and 3, and Opera 9, I can access the rectangle with document.defaultView.getComputedStyle(). But that doesn't...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
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...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
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.