Click here to Skip to main content
15,886,919 members
Home / Discussions / Web Development
   

Web Development

 
QuestionUpload preview and resize an image Pin
M.A.Raheem10-Nov-09 0:08
M.A.Raheem10-Nov-09 0:08 
AnswerRe: Upload preview and resize an image Pin
Abhishek Sur10-Nov-09 21:02
professionalAbhishek Sur10-Nov-09 21:02 
GeneralRe: Upload preview and resize an image Pin
M.A.Raheem10-Nov-09 22:17
M.A.Raheem10-Nov-09 22:17 
GeneralRe: Upload preview and resize an image Pin
Abhishek Sur10-Nov-09 23:24
professionalAbhishek Sur10-Nov-09 23:24 
GeneralRe: Upload preview and resize an image Pin
M.A.Raheem12-Nov-09 1:36
M.A.Raheem12-Nov-09 1:36 
GeneralRe: Upload preview and resize an image Pin
Jayapal Chandran12-Nov-09 7:33
Jayapal Chandran12-Nov-09 7:33 
GeneralRe: Upload preview and resize an image Pin
M.A.Raheem12-Nov-09 22:12
M.A.Raheem12-Nov-09 22:12 
QuestionThrowing an error to abort javascript execution Pin
Jayapal Chandran9-Nov-09 19:47
Jayapal Chandran9-Nov-09 19:47 
Hi,
I call a javascript function b from another function a.
in the function b at certain conditions i want to stop the javascript execution and i have did it by throwing an exception by using Throw New Error('Stopi').
It is working well.

1. Is it good to stop the execution of javascript abruptly.
2. Is it bad if the functions are not returned to the calling function and finally to the operating system.
3. I will there be a over flow of stack or will stack keep increasing if i am throwing many such errors.


Meanwhile IE shows the yellow exclamation icon in its status bar as usual that there is a javascript exception. When you click that you can see the error description as 'Stopi' which i have thrown.

Here is an example...

<input type='text' name='name' id='name' />

function validate()<br />
{<br />
      isempty('name','Please enter your name');<br />
     // no if condition or return statement here<br />
}<br />
<br />
function isempty(src,msg)<br />
{<br />
     var so = document.getElementById(src)<br />
     if(so.value=='')<br />
     {<br />
          alert(msg)<br />
          so.focus()<br />
          throw new Error('Stopi')<br />
      }<br />
}


so i dont have to use if condition when validating. no braces, no return statement, and no need to call focus for every if condition so this code reduces 6 lines and multiplied by number of input controls you are going validate. so i just need to call isempty and if the control has empty value then the user will get an alert and the execution stops.

Please suggest.

Today's Beautiful Moments are
Tomorrow's Beautiful Memories

AnswerRe: Throwing an error to abort javascript execution Pin
Eduard Keilholz11-Nov-09 22:54
Eduard Keilholz11-Nov-09 22:54 
GeneralRe: Throwing an error to abort javascript execution Pin
Jayapal Chandran12-Nov-09 7:22
Jayapal Chandran12-Nov-09 7:22 
NewsFree Windows Server 2008 R2 Developer Training Course on Channel 9 Pin
brucedkyle9-Nov-09 14:16
brucedkyle9-Nov-09 14:16 
QuestionDataGrid problem!! Plz Help!! Pin
Samad Maajid9-Nov-09 1:25
Samad Maajid9-Nov-09 1:25 
AnswerRe: DataGrid problem!! Plz Help!! Pin
Not Active9-Nov-09 1:48
mentorNot Active9-Nov-09 1:48 
QuestionNeed suggestion either Website or web service Pin
jaiswalrahul9-Nov-09 1:15
jaiswalrahul9-Nov-09 1:15 
AnswerRe: Need suggestion either Website or web service Pin
David Mujica9-Nov-09 3:24
David Mujica9-Nov-09 3:24 
QuestionLooking For Web Development Service Pin
Jennifer Clark8-Nov-09 22:09
Jennifer Clark8-Nov-09 22:09 
AnswerRe: Looking For Web Development Service Pin
Gamzun8-Nov-09 22:13
Gamzun8-Nov-09 22:13 
AnswerRe: Looking For Web Development Service Pin
Ashfield9-Nov-09 1:32
Ashfield9-Nov-09 1:32 
AnswerRe: Looking For Web Development Service Pin
The Man from U.N.C.L.E.9-Nov-09 7:11
The Man from U.N.C.L.E.9-Nov-09 7:11 
AnswerRe: Looking For Web Development Service Pin
Christian Graus11-Nov-09 12:29
protectorChristian Graus11-Nov-09 12:29 
AnswerRe: Looking For Web Development Service Pin
Oakman13-Nov-09 11:43
Oakman13-Nov-09 11:43 
AnswerRe: Looking For Web Development Service Pin
LinkagePersonnel4-Mar-15 21:06
LinkagePersonnel4-Mar-15 21:06 
Questionjson parsing problem asp.net Pin
Member 38014078-Nov-09 7:41
Member 38014078-Nov-09 7:41 
AnswerRe: json parsing problem asp.net Pin
Not Active8-Nov-09 11:43
mentorNot Active8-Nov-09 11:43 
GeneralRe: json parsing problem asp.net Pin
Member 38014078-Nov-09 14:32
Member 38014078-Nov-09 14:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.