Hi,
I am interested to join this group.

As i am new Javascript.I faced a problem with my website.There should
be a rollover effect on the menus.But it doesn't work properly.Would
you guys tell me what is the problem in my code.

http://www.lastagetimes.com/

Thanks


Here is the javascript for rollover

(function() {
        function search_field (field) {
                var str = 'Search';
                if (field.value == '') {
                        field.value = str;
                }

                field.observe('focus', function() {
                        if (field.value == field.defaultValue || field.value == 
str) {
                                field.value = '';
                        }
                });

                field.observe('blur', function() {
                        if (field.value == '') {
                                field.value = field.defaultValue;
                        }
                });
        }

        function ad_target (el) {
                el.observe('click', function(e) {
                        e.preventDefault();
                        window.open(el.href);
                });
        }

        function nav_links (el) {
                if (el.next('a')) {
                        el.next('a').insert({before: '  |  '})
                };
        }

        function preloadImg(image) {
                var img = new Image();
                img.src = image;
        }

        function rollovers (el) {
                el.srcOver = el.src.replace(/(\.[^.]+)$/, '_r$1');
                el.srcOut = el.src;
                preloadImg(el.srcOver);
                el.observe('mouseover', function() {
                        this.src = el.srcOver;
                });
                el.observe('mouseout', function() {
                        this.src = el.srcOut;
                });
        }

        function init () {
                $$('input.search').each(search_field);
                $$('div.ad_links a', 'a.flickr', 'div#flickr_photo
a').each(ad_target);
                $$('div.nav a').each(nav_links);
                $$('a.rollover img').each(rollovers);
        }

        document.observe('dom:loaded', init);

})();

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to