|
|||||||
| JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...) |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
document about firefox javascript
i need to use javascript for firefox.
if u have something about this. plez send to me. maxdezign@gmail.com sorry my language so bad. |
|
#2
|
|||
|
|||
|
Basically, JavaScript is JavaScript without consideration for the browser. The only exception to this is in IE -- but, even then, what works in the other browsers will also work in IE 99% of the time. So, is it just plain JavaScript you really want to know about?
|
|
#3
|
|||
|
|||
|
i want to use layer in firefox
i want to know function for write layer hide layer show layer and set x,y in layer now i can use this in ie bu this code error in firefox and ns sorry my eng so bad |
|
#4
|
|||
|
|||
|
HTML Code:
<div id="myLayer> This is a layer. </div> Code:
document.getElementById("myLayer").style.display = "none";
Code:
document.getElementById("myLayer").style.display = "block";
Code:
document.getElementById("myLayer").firstChild.data = "This is MY layer.";
|
|
#5
|
|||
|
|||
|
thank
|
|
#6
|
|||
|
|||
|
Cheers.
|
|
#7
|
|||
|
|||
|
I'm still having some problems with this..
could you check out my page at : http://www.welovewinter.com/showhidelayer.html I'm not exactly a developer, so i'm pretty clueless with some things.. ANy help would be greatly appreciated! works fine in IE, but not at all in firefox. Code:
<script language="JavaScript">
<!--
var NN4 = document.layers? true : false;
var IE4 = document.all? true : false;
var FF = document.getElementById? true : false;
var left;
var top;
function display(layerName) {
if (IE4) {
document.all[layerName].style.visibility = "visible";
}
else if(NN4) {
document.layers[layerName].visibility = "show";
}
else if(FF) {
document.getElementById('layer1').style.display = "block";
}
}
function hide() {
if (IE4) {
document.all['layer1'].style.visibility = "hidden";
}
else if(NN4) {
document.layers['layer1'].visibility = "hidden";
}
else if(FF) {
document.getElementById("layer1").style.display = "none";
}
}
// -->
</script>
Last edited by pizzaluva; 05-16-2005 at 07:17 PM. |
|
#8
|
|||
|
|||
|
I'd suggest rearranging this:
Code:
function display(layerName) {
if (IE4) {
document.all[layerName].style.visibility = "visible";
}
else if(NN4) {
document.layers[layerName].visibility = "show";
}
else if(FF) {
document.getElementById('layer1').style.display = "block";
}
}
Code:
function display(id) {
if (document.getElementById) {
document.getElementById(id).style.display = "block";
}
else if (document.layers) {
document.layers[id].visibility = "show";
}
else if (document.all) {
document.all[id].style.visibility = "visible";
}
else {
alert('Unknown browser category.');
}
}
Code:
function hide(id) {
if (document.getElementById) {
document.getElementById(id).style.display = "none";
}
else if (document.layers) {
document.layers[id].visibility = "hide";
}
else if (document.all) {
document.all[id].style.visibility = "hidden";
}
else {
alert('Unknown browser category.');
}
}
|
|
#9
|
|||
|
|||
|
that didn't seem to work.. actually now it won't work in IE.
heres what i have: Code:
<script language="JavaScript">
<!--
var left;
var top;
function display(id) {
if (document.getElementById) {
document.getElementById(id).style.display = "block";
}
else if (document.layers) {
document.layers[id].visibility = "show";
}
else if (document.all) {
document.all[id].style.visibility = "visible";
}
else {
alert('Unknown browser category.');
}
}
function hide(id) {
if (document.getElementById) {
document.getElementById(id).style.display = "none";
}
else if (document.layers) {
document.layers[id].visibility = "hide";
}
else if (document.all) {
document.all[id].style.visibility = "hidden";
}
else {
alert('Unknown browser category.');
}
}
// -->
</script>
<head>
<body>
<table width="500" border="1">
<tr>
<td align="center" class="tiny" bgcolor="#ff0000"
style="cursor: pointer" onclick=' display("layer1")'
onMouseOver="this.style.backgroundColor='000040';
return
true;" onMouseOut="this.style.backgroundColor='#ff0000';"><font color="white">SHOW WINDOW</font></td>
</tr>
</table>
<div id="layer1" style="left:305px; position:absolute; top:205px; visibility:hidden; z-index:0">
<table width="500" bgcolor="blue" height="300" border="2">
<tr>
<td height="30" align="center" class="tiny" bgcolor="#ff0000"
style="cursor: pointer" onclick=' hide("layer1")'
onMouseOver="this.style.backgroundColor='000040';
return
true;" onMouseOut="this.style.backgroundColor='#ff0000';"><font color="white">CLOSE WINDOW</font></td>
</tr>
<tr><td>LAYER 1 TABLE</td></tr>
</table>
</div>
|
|
#10
|
|||
|
|||
|
Change the quotes on these:
onclick=' display("layer1")' to be like this: onclick="display('layer1')" Although, technically, you should add return true; to the end of each function and code the events as follows: onclick="return display('layer1')" |
|
#11
|
|||
|
|||
|
I reworked your source a bit so that it will work now:
HTML Code:
<script language="javascript" type="text/javascript"> <!--// function display(id) { if (document.getElementById) { document.getElementById(id).style.display = "block"; } else if (document.layers) { document.layers[id].visibility = "show"; } else if (document.all) { document.all[id].style.visibility = "visible"; } else { alert('Unknown browser category.'); } return true; } function hide(id) { if (document.getElementById) { document.getElementById(id).style.display = "none"; } else if (document.layers) { document.layers[id].visibility = "hide"; } else if (document.all) { document.all[id].style.visibility = "hidden"; } else { alert('Unknown browser category.'); } return true; } //--> </script> <head> <body> <table width="500" border="1"> <tr> <td align="center" class="tiny" bgcolor="#ff0000" style="cursor: pointer" onclick="return display('layer1')" onMouseOver="this.style.backgroundColor='#000040'; return true;" onMouseOut="this.style.backgroundColor='#ff0000'; return true;"> <font color="white">SHOW WINDOW</font></td> </tr> </table> <div id="layer1" style="position:absolute; left:305px; top:205px; z-index:0;"> <table width="500" bgcolor="blue" height="300" border="2"> <tr> <td height="30" align="center" class="tiny" bgcolor="#ff0000" style="cursor: pointer" onclick="return hide('layer1')" onMouseOver="this.style.backgroundColor='#000040'; return true;" onMouseOut="this.style.backgroundColor='#ff0000'; return true;"> <font color="white">CLOSE WINDOW</font></td> </tr> <tr><td>LAYER 1 TABLE</td></tr> </table> </div> <script language="javascript" type="text/javascript"> <!--// var x = hide('layer1'); //--> </script> |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|