473,321 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Safari and javascript

How can you make a div visible and hidden in safari?

document.all["div_submit"].style.display = "none";

Does not appear to work.

Also, can anyone tell me how to turn on javascript error commenting in
Safari? Right now, if javascript fails or errors, the browser just sits
there and doesn't return any error message.

--
Christine
Sep 22 '05 #1
13 2841
ASM
Christine Forber wrote:
How can you make a div visible and hidden in safari?

document.all["div_submit"].style.display = "none";

Does not appear to work.


of course !
document.all
is Internet Explorer slang !

document.getElementById('div_submit").style.displa y = "none";

and ... miracle ... it is also understood by IE :-)

get FireFox and its add-on : "Web developer"
to fix your pb of JS console (and much more)

--
Stephane Moriaux et son [moins] vieux Mac
Sep 22 '05 #2
ASM
ASM wrote:

what was have to read :

document.getElementById('div_submit').style.displa y = "none";

if div_submit
is the id of the div !
--
Stephane Moriaux et son [moins] vieux Mac
Sep 22 '05 #3
ASM wrote:
Christine Forber wrote:
How can you make a div visible and hidden in safari?

document.all["div_submit"].style.display = "none";

Does not appear to work.


of course !
document.all
is Internet Explorer slang !

document.getElementById('div_submit").style.displa y = "none";

and ... miracle ... it is also understood by IE :-)

get FireFox and its add-on : "Web developer"
to fix your pb of JS console (and much more)


Thank you, I've relayed this response to my colleague. Re your
suggestion about FireFox, is it close enough to Safari to detect js
problems that would cause problems in Safari too?

--
Christine
Sep 22 '05 #4
Christine Forber <fi*******@lastname.net> wrote:
Thank you, I've relayed this response to my colleague. Re your
suggestion about FireFox, is it close enough to Safari to detect js
problems that would cause problems in Safari too?


It will certainly catch the vast majority of IE-specific script (for
example, uses of the document.all object), but AFAIK Safari uses a
script engine that is not based on anything used by Firefox. Both aim
for a good approximation of standards compliance, so script that runs
on Firefox has a good chance of running on Safari, but there are no
guarantees.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Sep 22 '05 #5
ASM
Christine Forber wrote:
ASM wrote:
Christine Forber wrote:


Thank you, I've relayed this response to my colleague. Re your
suggestion about FireFox, is it close enough to Safari to detect js
problems that would cause problems in Safari too?


except IE's slang,

generaly javascript (and beter DOM) is javascript

even for Apple :-)

fiew css3 understood by FF aren't by Safari
or not same way ...
-moz-opacity: 0.3; /* FF */
-khtml-opacity: 0.3; /* Safari */
filter: blah blah; 30; /* IE Windows */
-moz-radius: 10px;
radius: 10px;

it is Opera which could give some pb (as iCab)
(they can tell they ARE IE ! !)

in javascript jscript ->
sure detection if it is IE (all environnement and versions) :

var ie = false; /*@cc_on ie = true; @*/

--
Stephane Moriaux et son [moins] vieux Mac
Sep 22 '05 #6

Christine Forber wrote:

Also, can anyone tell me how to turn on javascript error commenting in
Safari? Right now, if javascript fails or errors, the browser just sits
there and doesn't return any error message.

--
Christine


Close Safari, open a Terminal window, and type at the prompt:

defaults write com.apple.Safari IncludeDebugMenu 1

Now there will be a Debug menu as the rightmost menu in Safari. Check
"Log JavaScript Exceptions" and select "Show JavaScript Console". Many
of the other items in the Debug menu are also useful.

You can then also use window.console.log("custom message") for your own
custom debugging messages.

Ian

Sep 22 '05 #7
On 22/09/2005 17:47, ASM wrote:

[snip]
in javascript jscript ->
sure detection if it is IE (all environnement and versions) :


I fail to see how browser detection is at all necessary. The OP simply
needs to avoid IE-specific methods and properties, and to test on a
range of browsers.

The closest browser to Safari would be Konqueror as the former uses the
latter's rendering engine (I don't know if that includes scripting
engine, though). Konqueror is part of the KDE windowing system for
Linux, and can be used in Windows through Cygwin.

Mike

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
Sep 22 '05 #8
ASM
Ian Osgood wrote:

Close Safari, open a Terminal window, and type at the prompt:

defaults write com.apple.Safari IncludeDebugMenu 1
wonderfull !
I didn't know that !
Great ! it works ! I have a new menu.

Is there a way to internationalize this menu ?
(to get it in french for instance)
Now there will be a Debug menu as the rightmost menu in Safari. Check
"Log JavaScript Exceptions" and select "Show JavaScript Console". Many
of the other items in the Debug menu are also useful.
as : Use Transparent Window
You can then also use window.console.log("custom message") for your own
custom debugging messages.


thanks
--
Stephane Moriaux et son [moins] vieux Mac
Sep 22 '05 #9
Ian Osgood <ia**@quirkster.com> wrote:
Close Safari, open a Terminal window, and type at the prompt: defaults write com.apple.Safari IncludeDebugMenu 1


You know, I'd really be ecstatic if Apple did less "thinking
differently" and more making their product sane, say by supporting
window.onerror; I was going to suggest it to OP before I realized how
pathetically broken Safari is in this respect...

I'd love to be proven wrong on this, by the way :-)

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Sep 22 '05 #10
Christine Forber wrote:
ASM wrote:
Christine Forber wrote:

How can you make a div visible and hidden in safari?

document.all["div_submit"].style.display = "none";

Does not appear to work.


of course !
document.all
is Internet Explorer slang !

document.getElementById('div_submit").style.disp lay = "none";

and ... miracle ... it is also understood by IE :-)

get FireFox and its add-on : "Web developer"
to fix your pb of JS console (and much more)

Thank you, I've relayed this response to my colleague. Re your
suggestion about FireFox, is it close enough to Safari to detect js
problems that would cause problems in Safari too?


Not really, I found that developing in Safari (pre 1.3) is a pain. The
tools available for Firefox a great and work pretty consistently on all
platforms so use that and just test in Safari.

It seems the tools for Safari have been greatly improved but I haven't
got the latest version and so can't comment on that.

But back to the question... how to debug in Sarari:

<URL:http://developer.apple.com/internet/safari/faq.html#anchor14>
--
Rob
Sep 22 '05 #11
RobG <rg***@iinet.net.au> wrote:
Not really, I found that developing in Safari (pre 1.3) is a pain. The
tools available for Firefox a great and work pretty consistently on all
platforms so use that and just test in Safari.
It's still a pain in 1.3, unless there is some way to get around the
fact that window.onerror doesn't work.
But back to the question... how to debug in Sarari: <URL:http://developer.apple.com/internet/safari/faq.html#anchor14>


I love how this FAQ is staying on the bleeding edge by validating
under the advanced HTML 4.01 Transitional specification.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Sep 23 '05 #12

Christopher Benson-Manica wrote:
Ian Osgood <ia**@quirkster.com> wrote:
Close Safari, open a Terminal window, and type at the prompt:

defaults write com.apple.Safari IncludeDebugMenu 1


You know, I'd really be ecstatic if Apple did less "thinking
differently" and more making their product sane, say by supporting
window.onerror; I was going to suggest it to OP before I realized how
pathetically broken Safari is in this respect...

I'd love to be proven wrong on this, by the way :-)

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.


I thought window.onerror had gone the way of the dodo. quirksmode.org
reports that it no longer works in *any* modern browser. I guess we
should be using try/catch/finally in these modern times. Only the
onerror handler for individual IMG elements seems to work reliably.

http://www.quirksmode.org/js/events_compinfo.html#misc

Ian

Sep 23 '05 #13
Ian Osgood <ia**@quirkster.com> wrote:
I thought window.onerror had gone the way of the dodo. quirksmode.org
reports that it no longer works in *any* modern browser. I guess we
should be using try/catch/finally in these modern times. Only the
onerror handler for individual IMG elements seems to work reliably.


http://ataru.gomen.org/scripterror.html

catches the script error in IE 6 and lower; in the IE 7 beta that I'm
running, "Display a notification about every script error" must be
enabled for the message to be displayed. Firefox 1.0.4 and Netscape 8
both catch it. Safari does not, nor does Opera 8.5. I suppose the
consensus is mixed, but I would certainly not say that it's "gone the
way of the dodo", and it continues to be an extremely useful feature,
at least in my eyes. Rather than littering code with try/except
blocks, it's very helpful to have a window.onerror to catch exceptions
and tell you where they happen. We use it to add script errors to a
database for tracking and fixing bugs, and it's been very successful
(although it also alerts us to a variety of arcane situations).
--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Sep 23 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bernard | last post by:
Hi, I am suddenly getting Safari script errors with the following user agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.2 (KHTML, like Gecko) Safari/125.8 In a...
5
by: joaopedrogoncalves | last post by:
Hi, I want to load an external javascript file, get its results and stick them inside a <div> block. I also want to do this in several places on a web page. This way the browser doesn't have...
8
by: Giuseppe Chielli | last post by:
Hi to everyone? Can someone tell me if there is a way to identify Safari...I found out that navigator.appName returns "Netscape" and I didn't found any option to change the browser's definition......
3
by: Shiva | last post by:
This is my HTML Page containing javascript --------------------------------------------------- <html> <head> <script language="JavaScript"> var isSafari = (agent.indexOf("Safari") != -1);...
2
by: laredotornado | last post by:
Hi, Is it possible to fool Javascript running on a Mac Safari web browser into believing it is a PC IE browser? We have the following JS code that is detecting both Mac and Safari. Sadly, we do...
3
by: Joe Cox | last post by:
I am having a problem with style properties for dynamic images in Mac OS X Safari. By dymanic images, I mean images allocated with the javascript 'new Image()' call. With static images (created...
7
by: Tom | last post by:
I have an oo-type javascript program running perfectly on IE 6.0+, FF 1.5+, and Opera 7+ on Windows 98+, Linux (RH 9, FC 6), and Mac OS X. 4. As usual, the Safari browser is not working correctly,...
13
by: Zwerfkat | last post by:
When running the code below, all browsers are showing "Hello World" except Safari which cannot match the regular expression. See also http://www.testabc.nl/safari/test.html When I change *? into...
15
by: GinnTech | last post by:
I have a site that works perfectly in IE6 IE7 FF2 FF3 but not in the latest Safari. Here is the issue. I am attempting to call functions within a flash object. When trying to attempt to...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.