|
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
|
|
|
|
|
the truth is that i have no money to pay, and my thought was to pay for example 5€. but if you don't have interest it doesn't matter
|
|
|
|
|
The url is :
http://www.baltimoreravens.com/?homepage=true[^]
I'm not very familiar with JS, but I am with OO languages (C#). I'd like to be able to get a copy of this video, is that possible? Normal firefox extension for this are not working.
Here is the code that I believe is responsible for the file.
Thanks for reading.
<div id="flashcontent110d559fdea542ea9c1c8a5df7e70ef9" class="takeoverVideo"></div>
<script type="text/javascript">
$(document).ready(function () {
var flashcontainer = $('#flashcontent110d559fdea542ea9c1c8a5df7e70ef9').clone().remove();
$('#flashcontent110d559fdea542ea9c1c8a5df7e70ef9').remove()
flashcontainer.appendTo('body');
var pageWrapper = $('#contentHdr');
var offset = pageWrapper.offset();
/*var browserVersion = (parseInt($.browser.version, 10));
if ($.browser.msie) {
if (browserVersion == 7) {
$('.takeoverVideo').css({top: offsetleft: (offset.left + 31)});
} else {
$('.takeoverVideo').css({left: (offset.left + 22)});
}
} else {
$('.takeoverVideo').css({left: (offset.left + 30)});
}*/
flashcontainer.css({
top: offset.top,
left: offset.left
});
var now = new Date();
var seed = now.getSeconds();
var random_number = Math.random(seed);
var range = random_number * 1000000000;
var rounded_number = Math.round(range);
function getRandomNum() {
return (rounded_number)
}
var so = new SWFObject("/Media/Flash/takeover.swf", "takeover", "996", "418", "9");
so.addVariable("xmlPath", "/%3fxml%3dtrue%26ran%3d" + getRandomNum());
so.addParam("scale", "noscale");
so.addParam("wmode", "transparent");
so.addParam("allowfullscreen", "false");
so.addParam("allowScriptAccess", "always");
so.write("flashcontent110d559fdea542ea9c1c8a5df7e70ef9");
});
</script>
<div id="contentHdr">
<div id="homepageRotator">
|
|
|
|
|
www.esp.com.cn[^]
=======================
i in the browser type that URL,,,just no abnormal,,but..i in "search engine"click the site,,,it will be jumpother site....i have seen it's source code,but no find out how does it jump? in advance thanks~ - -
"
|
|
|
|
|
Sorry you lost me.
The backend server can be doing all sorts that trigger a redirect, looking at the source from a client POV will not tell you what is going on in the background.
|
|
|
|
|
Why re-posts on Web Development[^] & PHP[^] forums?
BTW the site(you have mentioned in your question) is not loading for me..It showing something Chinese words in Title bar.
hack004 wrote: but..i in "search engine"click the site,,,it will be jumpother site....i have seen it's source code,but no find out how does it jump? May be code stored in other javascript file.
Using javascript(win.open() ) you can open another window. Also the target=_blank will open new window.
See the below code.
<html>
<head>
<title>Show search results in new window</title>
<script language="javascript" type="text/javascript">
function openwin()
{
window.open("http://www.codeproject.com/search.aspx?q=" + document.getElementById("txtText").value + "&sbo=kw","NewWindow","width=500,height=500");
}
</script>
</head>
<body>
<input type="text" id="txtText">
<A href="javascript: openwin()">Search</A>
</body>
</html>
The above page will show the search results(Codeproject) in new window.
|
|
|
|
|
thanks for reply~~~
---------------------
it's not open a other URL,,,
i'm mean is,,if in "search engine" click key work,for example it will be open www.123.com,but i'm type the URL in the browser,just show normal~
|
|
|
|
|