Review "show/hide Layers" Script For Errors And Cross Browser Compatibility

Jul 15, 2010

I found this script on a tutorial site but it had no summary of browser compatibility or any other issues. I know absolutely nothing about javascript and, although it works fine when I test it,

<head>
<script type="text/javascript">
lastone='empty';
function showIt(lyr)

[Code]...

View 7 Replies


ADVERTISEMENT

Cross Browser Spinner (show/hide)

Jun 30, 2006

Since the code is triggered ever onclick event it may be resource hungry on large pages.

I guess desired upgrades to suit it more for general purpose and reuse would be:

1> Replace document.write with a way of altering the CSS class rule property. Hard part on this after reading quirksmode would be in targeting the CSS rule in a cross browser, not to intensive way.

2> Find a better cross browser trigger attachment than the current firing on every click.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Spinner Test</title>
<style type="text/css">
<!--
.spinnerContainer {}
.spinnerLink {cursor: pointer;}
.spinnerContent {display: block;}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
document.onclick=function(evt){
//Credit to Beagle and coding forums http://www.codingforums.com/showthread.php?t=90062
if(!evt){evt=window.event;} // *** IE fix ***
var spinner;// *** element that got clicked ***
// *** Credit to PPK from quirksmode.org for this block ***
if(evt.target){spinner=evt.target;}
else if(evt.srcElement){spinner=evt.srcElement;}
if(spinner.nodeType==3){spinner=spinner.parentNode;} // defeat Safari bug
if(spinner.className=='spinnerLink'){
var contentDiv=spinner.nextSibling;
if(contentDiv.nodeType==3){contentDiv=contentDiv.nextSibling;}
//Action
if(contentDiv.style.display!='block'){contentDiv.style.display='block'}else{contentDiv.style.displa y='none'}
}//from: if(spinner.className=='spinnerLink'){
}//from: document.onclick=function(evt){

document.write('<style type="text/css">.spinnerContent {display: none;}</style>');
</script>
</head><body><br/><br/>
<div class="spinnerContainer">
<span class="spinnerLink">SPIN!</span>
<div class="spinnerContent">Content</div>
</div>
<br/><br/>
<div class="spinnerContainer">
<span class="spinnerLink">SPIN! 1</span>
<div class="spinnerContent">Content 1</div>
</div>
</body></html>

View 1 Replies View Related

Cross-browser Compatibility

Jan 5, 2006

Does anyone know of good links about cross-browser compatibility (html
attributes/css2/javascript)?

View 2 Replies View Related

Show Hide Layers

Apr 16, 2007

Code:

The idea is that the blue help text rechtangle will have to remain
visible when mouse over (because there will be soon links in it) and
invisible when onmouseout.

I have now placed javascript on the small numbered balls and within
the rechtangle itself.

But I have it in a way that when "onmouseout" the blue help rechtangle
will be hidden. But now the onmouseout event is acting like
onmouseover. Any Ideas to do this correctly? So right now when you
onmouseover it it will disappear :S

If I get this working I can start thinking of putting a timeout on the
rechtangle for it to disappear within a couple of seconds after
"onmouseout"

View 3 Replies View Related

Show/hide Layers

Feb 21, 2004

I'm designing a site that implements popup menus. There are several menus and each one is called by a mouseover event on an image. Each menu is set to show for about 3 seconds, and then it will go away. The only problem I am having is if you roll over two or more different images, both of the popup menus will display. I need some help on showing only one popup at a time. I'm sure it would be something like this...

HTML Code:

i = popup numbers; //which should be either 1 or 0
if (i == 1) {
hide(previous popup);
show(getElementById);
}

else {
show(getElementById);
}
I'm just not sure on how to determine the previous popup. Any suggestions?

View 1 Replies View Related

JQuery :: Show/hide Divs, Shadowbox Compatibility?

Sep 15, 2010

I'm currently programming a website and we wanted to have Jquery on it. This is my first real foray into Jquery (other than occasionally using a plugin here and there) so I'm a bit confused as to why what is happening is happening.

The idea is to have 3 different things going on: At the top of the website we want rotating ads. When one of them is clicked, it opens a video file in Lightbox style (darkens the BG) 3 rotating banners below that, when clicked they just go to a website 3 more buttons with play buttons in the corners. When the play button is clicked, a video player takes over the button and plays the video. So far I have the 2nd and 3rd one working. The video player works, the Jquery shows and hides the divs appropriately, and the rotating banners work great.

[Code]...

View 4 Replies View Related

Cross Browser Compatibility - Error: Uncaught Exception: [Exception... "Component Returned Failure"

Jan 10, 2009

I am having trouble getting my expanding menu to work in Firefox and Opera. It works fine in IE though. I did not write the javascript myself, as I am fairly new to JS, but I did all the HTML and CSS. I used the error console on FF, and also used FireBug. They both returned the following error:

[Code]...

View 23 Replies View Related

Browser Compatibility In Maps - Clear Cache And Browser History Does Not Work

Apr 20, 2011

The following code is working fine in firefox n not working in IE8... I get the Object Expected Error when the code hits the if(GBrowserIsCompatible())..... line in the javascript code. Clear cache and browser history does not work. Does anyone have a resolution for this?

[Code]...

View 1 Replies View Related

Cross Browser, Cross Domain Iframe Resizing Script?

Jun 18, 2009

Is there any way to resize an iframe dynamically to the height of its content that works cross browser and works when the iframe content is on another domain than the main page (I have access to both pages, so code can be put in either) Also, it must resize when links in the iframe are clicked (ie when a new page within the iframe is loaded)

View 1 Replies View Related

Show/hide Layer Dependent On Browser

Jun 17, 2005

I'm using the scroll function with a layer containing a graphic that sits over the slider on the y axis. This works fine in IE but overhangs the lower scrollbar arrow in Netscape, Firefox and Opera, killing its functionality, so I'd like to hide it in these browsers.

Could someone show me the best way to work a function that says (taking the layer ID as 'Bar')

IF browser = IE
THEN 'Bar' = visible

or (better?)

IF browser <> IE
THEN 'Bar' = hidden

And how should I allow this to behave in Safari?

View 19 Replies View Related

2 Browser Compatibility Problems

Nov 5, 2006

I was really hoping that someone could help me sort out two minor problems which I'm experiencing with by JavaScript and two browsers. (FireFox and Safari)

1. Safari doesn't support style="background:#CCCCCC;"
I use the following JS code to change the background color of my select boxes.

HTML Code:
var backcolor = "#CCCCCC";
document.getElementById('operatings').style.background = backcolor;
Unfortunately Safari doesn't support this. I could use the following :

HTML Code:
var backcolor = "#CCCCCC";
document.getElementById('operatings').style.background-color = backcolor;
...but it doesn't work. Probably because the JS reads the dash ( - ) as a syntax error. What alternative is there to this?

2. FireFox doesn't support 'value="";'
I use the following code to reset the selection of a <select> drop down :


HTML Code:
document.getElementById('operatings').value = "";
...but FireFox doesn't seem to support this.

What alterative is there to unselecting the selected the option in a <select> dropdown? I know about the reset button, but unfortunately I cannot use this.

View 5 Replies View Related

Browser Compatibility For Centering Function

Jul 23, 2005

I have the following funciton that centers my website content for any size window and will center it in real time as the window is expanded or shrunk. It is activated by a

onresize="CenterIt();"

in the body tag.

Works fine for IE. How do I make it compatible with netscape and most browsers? Better yet, is there a good single source that explains how to write javascript to be compatible with all browsers? 766 and 435 are the width and height of my table that surrounds the website data defined so:

<TABLE id="Main" style="position:absolute; z-index:0; top:0; left:0;">

function CenterIt()
{
newOffsetWidth = 0;
newOffsetHeight = 0;
if (document.getElementById)
{
winW = document.body.offsetWidth;
winH = document.body.offsetHeight;
}
else if (document.all)
{
/*
What goes here????
*/
}
else if (document.layers)
{
/*
What goes here????
*/
}

if (winW > 766)
newOffsetWidth = ((winW - 766) / 2) - 10;
if (winH > 435)
newOffsetHeight = ((winH - 435) / 2);

if (document.getElementById)
{
document.getElementById('Main').style.left = newOffsetWidth;
document.getElementById('Main').style.top = newOffsetHeight;
}
else if (document.all)
{
/*
What goes here????
*/
}
else if (document.layers)
{
/*
What goes here????
*/
}

}
CenterIt();

View 6 Replies View Related

Javascript Browser Compatibility Internet Resource?

Jul 23, 2005

Is there a resource on the internet to tell me which javascript can
work with which browser.

For instance, can I use style.color with all browsers - that kind of
thing.

View 3 Replies View Related

JQuery :: Function Browser Compatibility Information?

Dec 24, 2011

The following code works for Firefox but not on Chrome. Does anybody know what it doesn't work on Chrome. Is there a document on the browser compatibility info on each JQuery command.

[Code]...

View 3 Replies View Related

Protype.js Browser Compatibility - Does Not Work In IE 7 Or Lower

Dec 9, 2009

I have looked around and not been able to find a definitive answer to this. Prototype does not work in IE 7 or lower. All other browsers work just fine. Even something as simple as toggle(); will not work in older versions of IE. I don't get any errors or anything like that. It doesn't really seem like a compatibility issue as much as it does that those browsers could be parsing the code differently?

View 9 Replies View Related

JQuery :: Toggle Function - Hide/show Table When Hide/show Button Is Pressed

Sep 12, 2011

I am trying to hide/show table when hide/show button is pressed

Problem: The code works fine when I remove 'slow' from line 10. But with 'slow' in line 10 content of toggleButton doesnt change from Hide to Show when pressed.

Code:

View 1 Replies View Related

Universal Browser Compatibility - Mobile Device Connectivity This Is Making Things Even Harder

Feb 7, 2011

We run a click and sales tracking solution for our advertisers and as such we are having a few issues with browser compatability for certian sites that are ont eh Magento platform. Essentially we are just trying to create an image call in javascript that uses a few pre-populated variables from the checkout process.

So teh issue we are having doesn't seem to be broser specific. We are trying to simplify the javascript call to ensure we have the highest possible chance of compatiablity. Obviously now with so many differnt browsers and also mobile devide connectivity this is making things even harder. We know that our javascript calls are failing as we've been monitoring our IIS logs and can see the image calls are being made with blank variables. There are 3 different elements to our checkout calls that maybe you guys have experience of with possible issues or fixes:

1. unescape function
2. onload event function for images
3. creating images dynamically

these are very basic elements of the javascript core but aout 5-10% of our calls are failing with blank variables being passed into the image call. So the questions is what elements of our call will be the possibel sources of failure?

[Code]....

View 1 Replies View Related

Form Elements Show Above Layers (IE/N4)

Oct 13, 2001

Have form elements between two background layers (z-index set to -1 and 0). But when I show a layer above the form elements (triggered from a menu drop down list of dynamically produced data from a database table) they all appear above the layer (N4) and the select drop down shows above in the layer (IE). I have set the z-index to 2 for the above layer. Even tried placing the form into a layer and setting the z-index to 1!!

View 2 Replies View Related

Hide Form <select> Menus In IE From Appearing On Top Of DHTML Layers

Mar 14, 2006

I created this script because <select> form menus in IE on Windows appear on TOP of my DHTML layer navigation menus = client NOT happy and blames YOU. To avoid this crappy situation you can use my script to hide a certain number of the <select> menus when your DHTML layer nav menus are active.

Place this JavaScript in the <head> somewhere.

<script type="text/javascript">

// code to hide/show form menu drop downs ie/win courtesy of www.dreamingdigital.ca
// function should take in the parameter "visible" or "hidden" (the_action)

function dd_hide_show_selects(the_action) {
var dom = (document.getElementById) ? true : false;
var windows = (navigator.userAgent.toLowerCase().indexOf("windows")>-1) ? true : false;
var ie5 = ((navigator.userAgent.toLowerCase().indexOf("msie")>-1) && dom) ? true : false;
var cp_selects = document.getElementsByTagName("select");
var number_to_hide = 0;
var number_needed_hidden = 4; // 4 was the number of selects I needed to hide

if (windows && ie5) {
if (cp_selects.length > number_needed_hidden) {
number_to_hide = number_needed_hidden;
}
else {
number_to_hide = cp_selects.length;
}
for (var i=0; i<number_to_hide; i++) {
cp_selects[i].style.visibility = the_action;
}
}
}

</script>

An example of its use would be:

<a href="somewhere.html" title="Some text to describe the link."
onMouseOver="dd_hide_show_selects('hidden');" onMouseOut="dd_hide_show_selects('visible');">Something</a>

View 5 Replies View Related

Assign New Class To A Div To Show Errors If Any?

Sep 28, 2010

im trying to get the errors of an upload form validation displayed in a div.

<div id="error_div" class=""></div>

Here is the javascript:

<script type="text/javascript" language="javascript">
function validateForm(){
var flag = true;[code]....

Instead of showing the errors with an alert, i want to show them on the div and at the same time changing its class atribute to Alert, wich is a class i defined on my css page.Mybe with this?

document.getElementById(error_div).className='Alert';

View 2 Replies View Related

Form Validation--makes Errors Show In Hidden Div?

Nov 23, 2010

I have a user name, password, phone number etc., that all need to be validated before being submitted. The functions filter out the unwanted characters and null and zero length strings. I did have a pop up that listed the errors but I would prefer them to be listed below the log in screen that is a hidden div.I cannot get it to work.The validation works fine,

<html>
<head>
<title>WebCheatSheet - JavaScript Tutorial</title>[code].........

View 2 Replies View Related

Cross Browser X,y

Aug 6, 2006

I want to find x, y location of a layer or an image, or any other item
on a webpage.

1. It could be relatively or absolutely positioned.
2. It does not matter what browser the user is using.

what's the correct javascript code?

example: find x, y location of the image "someImage"

<html>
<body>
......... some html here....

<img src="someImage.gif" id="someImage" />
......... some html here....
<body>
</html>

View 2 Replies View Related

Cross Browser

Jul 5, 2003

After 1.5 years of writting my website I installed NS. It's JS works alot different to IE's, so it looks like I've got to write most of my site again!! [img]images/smilies/frown.gif[/img]

NS will only read 1 external JS file, which is abit of a nuisance as my site has a JS file common to site, another for the subfolders of the site, and the page's JS included with the HTML.

I'm trying to put all of common functions into one JS, but some of the functions have large amounts of text assigned to them. I'm trying to import the text using XML sheets as needed, but having a bit of a problem with the line
Code:
xmlDoc.childNodes[i].childNodes[2]
where NS will only read 1 array of childNodes. How do extract xml with NS's JS?

View 5 Replies View Related

Do I Have To Use Cross Browser DOM?

Aug 27, 2002

If my audience uses not so old browsers, do I have to use cross browser DOM? If they have IE 5 or later and Netscape 6 or Mozilla 1.0 or later and any version of Opera that is not older than 6 months?

View 2 Replies View Related

Cross-browser Programming

Jul 20, 2005

In some pages of my website I use a code like the following:

for (var n = 0; n < getTagsArray("SPAN").length; n++){

//SPAN is just an example. I also use other tags
tag = getTagsArray("SPAN")[n];

//make something with tag...
}


function getTagsArray(Tag){

if(document.all){ //Internet Explorer
return document.all.tags(Tag);
}
else if (document.layers){ //Netscape
eval("return document.tags." + Tag);
}}

I want to put all browser-specific code inside the getTagsArray
function. So far, I've programmed only for Internet Explorer (my
browser), but now I want to make my website visible to all browsers.
I'm not sure about the getTagsArray function. Is it right or is there
a better way to do the same thing? And how can I extend that function
to make it work in other browsers?

Finally, where can I find some information about cross-browser
programming? I have the javascript reference for Internet Explorer and
Netscape, but I know nothing about other browsers.

View 4 Replies View Related

Cross-browser Events API

Mar 16, 2005

a lot of the code I have trouble with is events-based, although there are some DOM-navigation problems that I've noticed in IE.

before I launch into a probably fruitless attempt to write an API that corrects IE's DOM-mangling, I'm wondering if someone else may have already invented that particular wheel.

ideally, this would be a script which I simply link to in the head, and then write valid DOM code which automagically works.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved