S
SAN CAZIANO
is there an istruction like the
try .....
except.....
try .....
except.....
except.....
is there an istruction like the
try .....
except.....
The page dynamically loads an image. If the image is large the <div
id="oLImage...> loads but if the image is small
<div id="oSImage ...> loads. You don't know which image is going to be
requested and therefore which div will be made.
[snip]
No script errors on the page but in fact an error does occur when <div
id='oSImage'....> (the image is small) results which goes to the
catch().
Michael Winter said:[snip]
The page dynamically loads an image. If the image is large the <div
id="oLImage...> loads but if the image is small
<div id="oSImage ...> loads. You don't know which image is going to be
requested and therefore which div will be made.
[snip]
No script errors on the page but in fact an error does occur when <div
id='oSImage'....> (the image is small) results which goes to the
catch().
Assuming I understand you correctly, that isn't a valid reason to use
try..catch. Assuming you can't generate code that is relevant to the
generated mark-up, test. If the element doesn't exist, you won't get a
valid object reference. You simply need to test for that and act
accordingly. But as I said, generating the correct script for the current
mark-up is surely the sensible thing to do.
Mike
Assuming I understand you correctly, that isn't a valid reason to use
try..catch. Assuming you can't generate code that is relevant to the
generated mark-up, test. If the element doesn't exist, you won't get a
valid object reference. You simply need to test for that and act
[accordingly.]
the test is try() the act accordingly is catch(e){}
[snip]
What's the problem with that?
Michael Winter said:[snip]
Assuming I understand you correctly, that isn't a valid reason to use
try..catch. Assuming you can't generate code that is relevant to the
generated mark-up, test. If the element doesn't exist, you won't get a
valid object reference. You simply need to test for that and act
[accordingly.]
the test is try() the act accordingly is catch(e){}
[snip]
What's the problem with that?
It's unnecessary?
If you have an object reference,
if(objRef) {
will check if it's non-null. If at the time of that test, objRef
references one DIV that doesn't exist, the reference will be null and the
expression will evaluate as false.
Mike
<snip>George said:the test is try() the act accordingly is catch(e){}
Richard Cornford said:<snip>
try-catch-finally is designed to handle exceptions; exceptions being
conditions outside of the ability of normal code to detect and control.
Their use in place of normal program flow control logic is
inappropriate, relatively inefficient (lots of overheads in scope chain
modification), incorrect, and should be broadly categorised as a hack.
It doesn't surprise me that you use try-catch for flow control, but as
usual you should not inflict your nonsense on others.
Richard.
George said:Why you Richard are determined to always patronize me whenever
you find my posts.
Why don't you just block my posts? Pleasre put me on your
ban list then I won't have to read your crap.
You don't like my crap so ban me. PLEASE!!!
As for your comment about the try catch well taken and
is exactly why I used it.
How you saw it done is yes unnecessary but so goddamn what.
| is there an istruction like the
| try .....
| except.....
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.