Results tagged Element
My previous entries regarding Multiple Drop Down Menus were for a basic working model and designed to work with Internet Explorer 6 and Firefox 2.
After making some refinements and enhancing the functionality for use with Safari, I have come up with a better functioning model.
Safari was not performing properly when I was using the onclick event. I guess it's a design thing within Safari that does not work right with click events attached to select elements. So, the onclick event got replaced by onfocus. Also instead of using the html events for focus (onfocus), the event handling was handed over to jquery. They state on their site that the event handling with in jquery is some percent faster than using HTML events and it certainly shows.
So, now I shall write some code for all this.
After making some refinements and enhancing the functionality for use with Safari, I have come up with a better functioning model.
Safari was not performing properly when I was using the onclick event. I guess it's a design thing within Safari that does not work right with click events attached to select elements. So, the onclick event got replaced by onfocus. Also instead of using the html events for focus (onfocus), the event handling was handed over to jquery. They state on their site that the event handling with in jquery is some percent faster than using HTML events and it certainly shows.
Event Handling is 103% Faster
In analyzing intense application code (specifically operations such as drag-and-drop) we looked for ways in which universal changes could be made that would affect all users. A frequently-called piece of code was that of the jQuery event handler, any optimizations to it would dramatically improve the performance of all resulting frequently-called events. By focusing improvements here all frequently-called events that you have should see immediate benefits.
Quoted from the jQuery site.So, now I shall write some code for all this.
More : Multi dropdown selects - Safari.
In my posting regarding Multiple Select Drop Down Menus I took a single select drop down menu and appended a dynamic multi select directly underneath it which appeared when an onclick event occurred to the single select drop down.
This time we are going to get a little bit fancy and create a custom drop down menu, that's similar to the other posting but slightly different and can be used in the same fashion.


We do this with a bit of css styling and JavaScript. With a bit of imagination and css styling this can be a pretty wicked technique. I might have to play around with this if I can find some time.
Give it a try: Custom Select Element.
First we start with an image, which is our States image and we put that into a link. As such:
<a href="#" onclick="populate();" id="stateImg"><img src="states.jpg" alt="Select a State" /></a>
We add on onclick() event to the anchor element and call it populate(). Of course you can call it whatEverYouWantTo(). We also have to add an id to the link (id="stateImage").
This time we are going to get a little bit fancy and create a custom drop down menu, that's similar to the other posting but slightly different and can be used in the same fashion.

We do this with a bit of css styling and JavaScript. With a bit of imagination and css styling this can be a pretty wicked technique. I might have to play around with this if I can find some time.
Give it a try: Custom Select Element.
First we start with an image, which is our States image and we put that into a link. As such:
<a href="#" onclick="populate();" id="stateImg"><img src="states.jpg" alt="Select a State" /></a>
We add on onclick() event to the anchor element and call it populate(). Of course you can call it whatEverYouWantTo(). We also have to add an id to the link (id="stateImage").
More : Dropdown Menus: Revisited.
There are a couple different ways I have seen to swap css files using javascript but I have yet to see one as simple as the way I have written it to work. Someone else must have come up with this idea at sometime or some where before.
Although, I haven't seen or had many uses or reasons to do this.
On with the show!
At the top of your document you have the head contents containing your css files and JavaScript code. Before the JavaScript is the css file include.
<link href="layout.css" rel="stylesheet" type="text/css">
Since every element/object on a web page can be retrieved using JavaScript because they reside inside of the DOM, you can add an id to the css declaration, like so.
<link href="layout.css" rel="stylesheet" type="text/css" id="css_page">
Now you can easily obtain the link object using getElementById("css_page").
Although, I haven't seen or had many uses or reasons to do this.
On with the show!
At the top of your document you have the head contents containing your css files and JavaScript code. Before the JavaScript is the css file include.
<link href="layout.css" rel="stylesheet" type="text/css">
Since every element/object on a web page can be retrieved using JavaScript because they reside inside of the DOM, you can add an id to the css declaration, like so.
<link href="layout.css" rel="stylesheet" type="text/css" id="css_page">
Now you can easily obtain the link object using getElementById("css_page").
More : Swap css file with js.
What is the DOM? The DOM is an object oriented view of HTML documents. HUH?
An HTML page is a document, within that page exists tags such as:
<body></body>, <h2></h2>, <div></div>, <span></span>
These html tags could be referred to in a few ways, such as, tags, elements, or even objects. When working with or manipulating the dom you will mostly refer to the items as elements, like when using getElementById(). But when standing back and viewing you document in greater detail these elements represent more of a life as an object. If your familiar with OOP programming you will know and an object is related to another object as are it's attributes and so on. We refer to this as a hierarchy.
In an HTML document there are elements that are on top of other elements that cause the characteristics of that element. For instance:
An HTML page is a document, within that page exists tags such as:
<body></body>, <h2></h2>, <div></div>, <span></span>
These html tags could be referred to in a few ways, such as, tags, elements, or even objects. When working with or manipulating the dom you will mostly refer to the items as elements, like when using getElementById(). But when standing back and viewing you document in greater detail these elements represent more of a life as an object. If your familiar with OOP programming you will know and an object is related to another object as are it's attributes and so on. We refer to this as a hierarchy.
In an HTML document there are elements that are on top of other elements that cause the characteristics of that element. For instance:
More : DOM (Dominate Object Model).
With prototype 1.6 being released it has left some abilities, classes, functions, or methods behind. One of those depreciated classes is the Insertion class which was replaced with insert(). insert allows you to insert content into your documents. That content can be either text, HTML, a DOM Element, or any type of object with a toHTML or toElement method. The content can be placed using a parameter of bottom, top, before, or after value. Let's try it.
First we are going to create a function and call it myFunction and a new String object which we will use for our insert.
function myFunction() {
var test = "This is a new String.";
}
Now let's create an instance of our insert class.
new Element.insert('myDiv', {top:test});
So now our script looks like this
First we are going to create a function and call it myFunction and a new String object which we will use for our insert.
function myFunction() {
var test = "This is a new String.";
}
Now let's create an instance of our insert class.
new Element.insert('myDiv', {top:test});
So now our script looks like this
More : Prototype 1.6, insert();.
2whoa.com - NEW!!
Home
jQuery
Javascript
Archives
MLB Wallpapers
NFL Wallpapers
NBA Wallpapers
NHL Wallpapers
Flames Wallpaper
Watch Live Games!
NHL
NBA
Soccer
NFL
and more..
BMW, Toyota, Volvo, Saab, Audi, Nissan Mercedes, Volvo, Nissan,Volvo Volvo Volvo Honda, Acura, Honda, Acura Forerunner, SUV, Volvo, Mercedes, Toyota
Volvo, Toyota, Volvo, Saab, Audi, Nissan Mercedes, Volvo, Nissan,Volvo Volvo Volvo Honda, Acura, Honda, Acura Forerunner, SUV, Volvo, Mercedes, Toyota
Home
jQuery
Javascript
Archives
MLB Wallpapers
NFL Wallpapers
NBA Wallpapers
NHL Wallpapers
Flames Wallpaper
Watch Live Games!
NHL
NBA
Soccer
NFL
and more..
BMW, Toyota, Volvo, Saab, Audi, Nissan Mercedes, Volvo, Nissan,Volvo Volvo Volvo Honda, Acura, Honda, Acura Forerunner, SUV, Volvo, Mercedes, Toyota
Volvo, Toyota, Volvo, Saab, Audi, Nissan Mercedes, Volvo, Nissan,Volvo Volvo Volvo Honda, Acura, Honda, Acura Forerunner, SUV, Volvo, Mercedes, Toyota


