|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I'm pretty good @ JavaScript, but I was wondering if you could help me with a few things I haven't learned...
I need help, basically, in knowing how, why, and when to use eval(),onError,and fileUpload(). I was also wondering if you could get Math.random() to return values between 1 specified number and another, rather that 0 to a specified number. Thanks! |
|
#2
|
|||
|
|||
|
eval() is perhaps one of the most useful methods in javascript, it takes the argument, and tries to convert it into a javascript object, or any representation. It can sometimes act in place of parseInt() when mixing strings with numbers, and is necessary for DHTML in NS4:
function doSomething(layername) { eval("document."+layername+".visibility="hide" } If you didn't use eval(), NS4 usually kicks up an error. (Atleast in my experience.) onerror can be used on two things: window.onerror You can suppress error messages, and you can take some arguments on a function and actually obtain the error info. With that, you could fill out a form and submit it to a server side script, to notify you for example. <img src="bla.gif" onError="alert('Image couldn't load.')"> Once again, you could try the above mailing, or use a script I wrote for someone at the www.wsabstract.com help forums to replace tge image with a default one if it doesn't load. As for fileUpload(), I never have seen it in javascript. Math.random() is very flexible in that manner. var min=10; var range=5; var number=(Math.random()*range)+10; That will generate a random number from 10 to 15. Hope that helps some. ![]() ------------------ |
|
#3
|
|||
|
|||
|
Just a small correction on my above post, you do not need eval() for DHTML in NS4. I was thinking of something else. But you can still use it in the same manner:
function disable(what) { eval('document.THEFORMNAME.'+what+'.disabled=true) } ------------------ Jason Contact Me Moderator @ <A HREF="http://www.wsabstract.com Javascript" TARGET=_blank>www.wsabstract.com Javascript</A> Request and Installation Help forum |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > eval(),onError(),fileUpload(),Math.random() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|