|
Have you debugged? Once you have you will be able to find the issue easily.
I would use JQuery and do away with this mess of nested try/catch blocks
No comment
|
|
|
|
|
yes that is where I got the error message from (the debugger)...
I'm just trying to learn how to get a JavaScript app to work with a database and this was the first part of the tutorial. If you have any better ideas I'm open to them as I haven't invested too much into this one yet
Does onChange="ajaxFunction();" need to be single quote?
|
|
|
|
|
MacRaider4 wrote: Does onChange="ajaxFunction();" need to be single quote?
Wouldn't it be faster to test that theory yourself rather than ask if that's the solution and wait for an answer?
EOL
|
|
|
|
|
I tried it that way and it made no difference, but I was wondering as I would like to learn the "right way"... forgot to mention that in my reply sorry
|
|
|
|
|
I typically favor using double quotes, though single quotes would work too. When working with ASP.net, I find it easier to sometimes use single quotes, as binding often makes use of double quotes (and having double quotes inside double quotes can cause errors).
EOL
|
|
|
|
|
Coming from an application background this web stuff is a bit hard to get used to, but doesn't seem too bad all in all. Though it would be nice if you didn't have to go about things in a round about manner.
Back to the original issue, it seems like the function call wants something in the () however I don't have anything specified in the function it self so that doesn't make sense.
|
|
|
|
|
Ok I've found it... simple mistake I guess...
<script type="text/javascript">
vs
<script type="txt/javascript">
forgot the 'e' in text....
|
|
|
|
|
HTML attributes should be enclosed in double quotes, as it's part of the same family as XML. Most browsers will tolerate all sorts of bad markup but to do it right is to use doubles there. Quotes within Javascript can be either, as long as they are paired with the same type, and either is fine in any situation.
|
|
|
|
|
Well if double is the standard then I'll go with double. Thanks for the help!!
|
|
|
|
|
I created a PDF form from an excel file. I have everything figured out, except one of the fields in which I am able to round the answer up to the nearest integer, but I need to take it one step further and round it to the nearest 5 or 0. This is what I an using as my custom calculation script:
(Math.ceil(CourseHours/40) + " ");
I have just started learning javascript so I found this off of a website. If anyone could help I would certainly appreciate it. Thank you in advance.
|
|
|
|
|
Use
Math.round( n /5) * 5;
where n is the number you are looking to round off.
Imagination is the one weapon in the war against reality!!!
aniruddhaloya.blogspot.com
|
|
|
|
|
That did not work but looking at my email again, the entire script didn't paste. It is
(Math.ceil(CourseHours/40)+" ");
Sorry about that. Thanks much.
modified 15-Jan-12 20:43pm.
|
|
|
|
|
I guess your entire script is not there again...
Anyways... Math.ceil will always take it to next higher number whereas Math.round round it to the nearest integer. So you can choose as per your requirement.
From what I think you are looking to do is - You require (CourseHours/40) rounded to nearest 0 or 5... i.e. the number you eventually looking to round off is the output of - CourseHours/40...
So for my solution to work - 'n' should be substituted by - CourseHours/40
i.e
Math.ceil(CourseHours/40/5) * 5 or use Math.round as per your requirement.
I hope this helps.
Imagination is the one weapon in the war against reality!!!
aniruddhaloya.blogspot.com
|
|
|
|
|
It seems to work, but what I am finding is that, as most of the answers will be less than 1, it is rounding it to the nearest 0 or 5 in the thousandths when I need it to be no larger then hundreths. SO all I should have as the final answer is .15 or .35. Does that make sense?
|
|
|
|
|
You can try using "Number".toFixed(x) along with the existing solution for fixing that.
More info of your data set may help to find a better solution though
Imagination is the one weapon in the war against reality!!!
http://aniruddhaloya.blogspot.com
|
|
|
|
|
Hi,
Try Math.floor()
Thanks,
|
|
|
|
|
This is going to be my first JavaScript application as strict PHP doesn't seem like it's going to work. What I need to do is create a football pool square chart. I'm not looking for someone to develop it for me, just for some guidance as I want to learn what I'm doing. From what I've read I'm going to need to use PHP to do the database calls but I'm not sure how to get that info back to JavaScript.
Looking for some ideas... thanks!!!
|
|
|
|
|
I found an ajax example but can't get it to work... started a new thread for that.
|
|
|
|
|
Hi everyone!
I am currently working on a project to make a web site W3C compliant. The site currently uses a lot of instances of document.all , document.form.object and form.object notations. I am mostly concerned about formname.objectname style. I have been trying to search DOM specs on www.w3.org[^] and google but couldn't find any specific information related to this type of usage. So my question is if anyone knows of the place (preferrably official) that says whether this usage is allowed and is cross-browser or should I replace it with document.getElementById ?
Thanks in advance!
|
|
|
|
|
Can you not use jQuery[^]? Won't that give you full cross browser functionality with more compact/consistent notation and W3C compliance? (Not 100% about the compliance - you'd need to check that).
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
The page is written in legacy ASP and has lots of client side calculations in JavaScript. Eventually this page will have to be rewritten from scratch anyway. So, given the limited time frame alloted for this project I do not want to spend time migrating this page to jQuery (however we do use jQuery on new pages). Since there are lots of such instances this will mean that QA team will have to do more testing. So, if notation like document.formname.objectname is still compliant and supported in all browsers, at least in some degree, then I prefer to leave it as it is and deal with problems as they come.
|
|
|
|
|
I want to create a vote system and i have two ideas.
1. a vote system where the member will only write [b][player's vote][/b] like in boardgamegeek site, and his vote will automaticaly submited and then a message from a standard member will be posted, summarising the votes of every player. but this sound so difficult to me.
2. so i thought another way.
this voting system should be a hook or application for myboard, where you will input players name [candidates] first from the ADMIN CP. Then, a button named "Vote" should appear when a user of a specifiec group, want post a message. Then it prompt a message which ask you, "who do you vote?", confirm message, and the it print the results. In the section you vote you can also write a substring of tha name of the person you vote.
So what are mine problems
FIRST (about memory)
1. how to save the members vote in a Database?
2. how can i stop member if he have vote already?
3. how can he change his vote?
SECOND (appearance)
1. how can i set this button to the users post creator?
2. how can this button exist only in a specifiec thread or threads?
3. how can this button appear only in user of a specifiec group?
THIRD (control and change values)
1. how can i control everytime the candidates, the thread where the button will exist and in which group will it appear?
2. how will the system react after a vote submitted? It should sent a post of a Specifiec Member (changable everytime)summarizing the votes and after 10-15 posts of other user, it will send again this message.
PLZ HELP ME... here is my try. don't laugh
http://www.mediafire.com/?au4eqxif6ymqoya[^]
|
|
|
|
|
Don't cross post: you had some responses in Q&A: posting the same question twice will not help to advance your cause!
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
how much do you want ? can you do this job?
|
|
|
|
|
dannaros wrote: how much do you want
What are you willing to pay?
dannaros wrote: can you do this job
Of course.
(Actually, I would have zero interest in doing this: try posting on rentacoder or somewhere like that.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|