|
Hi all,
I am in urgent need of a solution for the problem I have.
I have a grid inside a div tag, but the horizontal scroll bar moves to slowly and I want to increase the speed.
Please help.
Regards
Virat Soni.
|
|
|
|
|
Make the font smaller.
If that is not an option then please post a bit more information, like to you mean a manually moved scroll bard or an JavaScript controlled one?
Brad
Australian
"The Probability of you doing that makes 0 look like a big number" - My Mate Oxley
|
|
|
|
|
Thanks for your response.
Making font smaller is not an option.
This is the scrollbar of the div within which I have a grid.
Like the following
<div id="tbl-container" style="OVERFLOW: auto; WIDTH: 995px; HEIGHT: 400px">
-------code for the div---------
</div>
Its working fine except the speed of the scrollbar in the horizontal direction is too slow.
|
|
|
|
|
Unless you're scrolling programatically, the speed is determined by the browser and the OS it runs on. If you have an extremely large amount of data, the speed may even be limited by processor and memory constraints. In this case, the best you can do is simplify the data being scrolled.
|
|
|
|
|
Can you help me in determining how to scroll it programmatically?
|
|
|
|
|
theDiv.scrollTop = position;
|
|
|
|
|
Using IE 6, I the error 'this.prototype' is null or not an object.
The script that defines my object and creates objects of this type looks something like the following:
function NameObject( Name ) {
this.Name = Name;
this.prototype.FixName = function() {
if( this.Name && this.Name.length != 0 )
this.Name = this.Name.charAt(0).toUpperCase() +
(this.Name.length > 1 ) ? this.Name.slice(1) : "";
}
this.FixName();
}
var Ted = new NameObject( 'ted' );
var Bill = new NameObject( 'bill' );
The books I have on Javascript don't indicate that IE6 doesn't support this feature, but from the error I'm getting ('this.prototype' is null or not an object) the magic where the prototype sub-object of my NameObject is supposed to be automatically created and then the members exposed in my class isn't happening.
Why is this, and is there a work around that provides the same benefits as real prototyping?
Thanks in advance.
|
|
|
|
|
Here is one possible work-around, but I don't know if it actually saves on the method storage space. I know it doesn't do the automatic internal prototype creation and mapping to top level properties, like prototyping is supposed to do, but if it saves the space needed to save the method bodies, that's enough for me.
function NameObject( Name ) {
//
// define FixName_ProtoType Method outside of the
// instance, i.e., no 'this.' in front of the
// function name.
//
function FixName_ProtoType () {
var NewName = "";
if( this.Name && this.Name.length != 0 ) {
NewName = this.Name.charAt(0).toUpperCase();
if( this.Name.length > 1 )
NewName += this.Name.substr( 1 );
this.Name = NewName;
}
return this.Name;
};
//
// create the Name property.
//
this.Name = Name;
//
// Attach the FixName_ProtoType Method to the
// instance so it can be called using x.FixName().
//
this.FixName = FixName_ProtoType;
//
// Execute the method for the newly created object.
//
this.FixName( this.Name );
}
However, I suspect that because FixName_ProtoType's declaration is nested inside of NameObject, that javascript will just create one per instance. To get around this I may have to move the FixName_ProtoType declaration outside of the NameObject's body, but then that wouldn't expose the function definition.
Anyway, I'm still interested in comments about how to make real prototyping work in IE6 or a better work-around, if there is one.
Thanks again.
|
|
|
|
|
howardjr wrote: how to make real prototyping work in IE6
function jsps_strequals(s)
{
return ( 0==this.indexOf(s) && this.length == s.length);
}
String.prototype.equals = jsps_strequals;
var str = "Hello";
if(str.equals("Hello"))
alert("Hello found");
led mike
|
|
|
|
|
Thanks
So you can't define the prototype in side of the contructor?
|
|
|
|
|
howardjr wrote: So you can't define the prototype in side of the contructor?
Sure you can, you just don't use the keyword "prototype".
function JSRect( x, y, r, b){
this.left = x;
this.top = y;
this.right = r;
this.bottom = b;
this.width = jsr_width;
function jsr_width(){ return this.right - this.left; }
}
led mike
|
|
|
|
|
Looks like it's an either or thing. Either you can define the functions inside of the object or you can prototype them.
Thanks.
|
|
|
|
|
howardjr wrote: The books I have on Javascript don't indicate that IE6 doesn't support this feature, but from the error I'm getting ('this.prototype' is null or not an object) the magic where the prototype sub-object of my NameObject is supposed to be automatically created and then the members exposed in my class isn't happening.
It is. You're misunderstanding how it works and how it can be used.
Every object in JavaScript has a prototype. It's how JS object inheritance works. However, you can't change the prototype for an object; you can only specify what the prototype will be for new objects. By the time your NameObject constructor executes, it's too late - the new object has already been created, all you can do is initialize it. Even if you created a new object and assigned it to this.prototype, it wouldn't do any good - the .prototype member only tells the interpreter what it should use as the prototype for new objects created based on the object.
What you really want to do is set up the prototype before creating new NameObject objects:
function NameObject( Name )
{
this.Name = Name;
this.FixName();
}
NameObject.prototype.FixName = function()
{
if ( this.Name && this.Name.length != 0 )
this.Name = this.Name.charAt(0).toUpperCase() + (this.Name.length > 1 ? this.Name.slice(1) : '');
}
var Ted = new NameObject( 'ted' );
var Bill = new NameObject( 'bill' );
|
|
|
|
|
Thanks
I personally like to have all of my methods defined inside of the object/class definition, including the prototype, if possible.
What I did as an alternative is to define and newed a "prototype_class", that didn't use the .prototype. keyword, that contained all of the methods and constants I only wanted one version of, then attached these to my working object that I new for each instance I need:
NameObject_ProtoType = new function () {
this.constant=0;
this.fixname = function() { ... };
}
function NameObject( Name ) {
this.constant = NameObject_ProtoType.constant;
this.fixname = NameObject_ProtoType.fixname;
this.name = Name;
}
This approach seems to work, and all of the constants and methods in the prototype object seem to only exist once for all of the NameObjects I create. With this approach I sort of get the the inline definition I want, at least to the extent that all of the prototyped items are neatly bound up in the prototype object.
|
|
|
|
|
I have the following snippets in a CSS:
body{
background-color: #f0f0f0;
color: #000000;
}
td.nav{
background-color: #e0e0e0;
}
td.l_col{
width: 25%;
border-right: thin solid;
}
The body backgroung color and the td.nav background color are not set and the right border does not render in IE but renders fine in Opera and FF.
The td.l_col width renders properly in all browsers.
Is there anything I need to do differently in the CSS to get IE to render in a similar manner to Opera and FF?
I'm on-line therefore I am.
JimmyRopes
|
|
|
|
|
Unless you develop for some other media than screen, specify the border width in pixels.
Other than that the CSS look all right. How do you use it in the HTML code?
---
b { font-weight: normal; }
|
|
|
|
|
Thanks for the reply.
It is generally not a good idea to specify fixed dimensions.
People set their resolution based on individual preferences and if you try to guess the resolution you will undoubtedly be wrong some percentage of the time.
Having said that I will try a test with a fixed border width but that still doesn't account for the background color not rendering.
Thanks for the suggestion.
I'm on-line therefore I am.
JimmyRopes
|
|
|
|
|
JimmyRopes wrote: but that still doesn't account for the background color not rendering
That's why I asked how you are using the CSS in the HTML code. It's so hard to help people when you have to guess what they are doing...
---
b { font-weight: normal; }
|
|
|
|
|
Trying to set the background color and color for the body.
...
Trying to set the background color for table cells of a particular class.
...Trying to set the width and right border for table cells of a particular class.
...All of which are working in Opera and FF but not in IE. The width also works in IE but there is no right border rendered.
I'm on-line therefore I am.
JimmyRopes
|
|
|
|
|
I have tried your CSS with your HTML code, and it works just fine. The color of the border is different in IE of course, as you haven't specified any color at all.
---
b { font-weight: normal; }
|
|
|
|
|
Thank you Guffa. As the saying goes, you are a scholar and a gentleman.
I put a color on the border specification and it now works in IE.
Now comes the rub! The border renders relatively thicker in IE than it does in Opera and FF - at default thickness - which makes my horizontal rules look thin in comparison on IE.
In Opera and FF the thin border specification renders the same as the default HR but in IE the thin border is approximately twice as thick as the default HR.
The other difference is that when I tried the color specification for both the border and HR in the CSS both the border and HR were rendered as specified in IE but in Opera and FF the border was the specified color and the HR was the color I specified in the CSS for the body. This tells me that the body color specification is being applied in Opera and FF but not in IE. I will need to look into that further.
Getting back to the border/HR width rendering differently between browsers since the HR width - the size parameter - is specified in pixels I took your original advice and also set the border width to the same pixel value. As much as I do want to specify relative widths for everything - so the pages scales well at different browser resolutions – there didn’t seem to be a choice for HR size as it is specified in pixels. This made the border specification in the same number of pixels a moot point. In theory they should at least look balanced at whatever screen resolution they are being rendered.
Sounds simple in theory but getting a compromised solution to work in all three browsers remains an enigma as now IE renders the HR size and color specification the way it is specified in the CSS but both Opera and FF do not!
IE renders as specified in the CSS for both size and color specifications but Opera and FF still use the background color and default size (thickness) for the HR but the CSS specified size for the border!
Then there is still that pesky problem with background color. This is the type of problem that drives web developers crazy.
I will have to step back and construct a test page that has nothing more than a table with borders and a HR and see if I can get this all sorted out. I love a good mystery!
Thank you very much for your diligence in helping me find new approaches to this problem. I will have to keep working on it but now I have more insight into the problem, thanks to your help.
I'm on-line therefore I am.
JimmyRopes
|
|
|
|
|
JimmyRopes wrote: Now comes the rub! The border renders relatively thicker in IE than it does in Opera and FF
That is because the values "thin", "medium" and "thick" doesn't have any absolute thickness specified in the standard. It's up to the browser to determine a proper thickness based on the media where the style is used. The resulting value may differ depending on what the browser takes in account, and what the creators of the browser regards as a "thin" border.
JimmyRopes wrote: The other difference is that when I tried the color specification for both the border and HR in the CSS both the border and HR were rendered as specified in IE but in Opera and FF the border was the specified color and the HR was the color I specified in the CSS for the body. This tells me that the body color specification is being applied in Opera and FF but not in IE. I will need to look into that further.
The hr tag dates back to the time before web pages had layout, and doesn't play very well with modern CSS. All specific attributes for hr are deprecated since HTML 4.0.
---
b { font-weight: normal; }
|
|
|
|
|
I would imagine the problem may lay elsewhere (possibly in the HTML) as IE renders a body background colour just fine. Start working backwards, removing the table and seeing what effect that has. There is also nothing wrong in specifying a width as a percentage (contrary to above comment)
|
|
|
|
|
I am in the process of re-designing the site so it is quite possible that I did make a mistake in my editing. I am validating the code as XHTML, a stricter standard than HTML, so I would have expected the valadion parser to have choked if I made a mistake in formatting.
What has me confused is that the site renders well in Opera and FF but not in IE and I am not using any formatting that is not common HTML.
I am making an async XMLHTTPRequest which is working in all browsers so that is not the cause of the rendering problem (famous last words).
Since the entire page has to be rendered before the body onload event fires triggering the async request it shouldn't matter but I have been fooled into thinking that I know what is going on before. I will take it out for a test just in case it is the cause of the problem.
If that doesn't work I will start to build the page again adding components until I can detect where I am going wrong.
Thanks for the help.
I'm on-line therefore I am.
JimmyRopes
|
|
|
|
|
I have the following regular expression for validating email addresses
/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@
((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])
|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
I would like to use the expression with the javascript 'new RegEx("Insert Regex")' notation. However, I am struggling to format the expression properly when trying to put it inside the quotations.
Can anyone show me how the regexp should look to work with the 'new RegExp()' notation?
Thanks in advance
|
|
|
|