|
i want to make a program in java script to show it is leap year or not & shows leap month in year like febuary is day 29 please help me
|
|
|
|
|
If year is divisible by 4 OR
if year is century AND year is divisible by 400
then
it's a leap year
so for example 1900 is NOT a leap year
2000 is a leap year
2011 is NOT
2012 IS
The best things in life are not things.
|
|
|
|
|
Richard has shown you the rules for testing a leap year, but there is another method, try to create the 29th Feb for a given year, then get the date, if it == 29 it is a leap year, and return true, else false;
See this function; http://www.adp-gmbh.ch/web/js/date/is_leap_year.html[^]
|
|
|
|
|
I should have known there's a Date class in JavaScript; something else for me to learn.
The best things in life are not things.
|
|
|
|
|
Hey guys!
I have a div in a page called h-accordion.
After this div, there is a second one. When I pres on the first one, the second one toggles (hidden/shown).
The whole set repeats itself several times in the page - there are multiple "sections" which the user can "open" one by one.
I have the following code to make it work:
$('.h-accordion').click(function(){ <!--on click on this element-->
if($(this).next().is(':hidden')){ <!--if the next element of the title is hidden-->
$(this).next().slideDown(); <!--peform the slide down-->
$(this).attr('rel',"opened"); <!--change the state to openened -->
} else { <!--if the next element of the title is not hidden-->
$(this).next().slideUp(); <!--perform the slide up-->
$(this).attr('rel',"closed"); <!--change the state to closed -->
}
return false;
}).css('cursor', 'pointer').next().hide();
Could you please tell me what the last line does? Can`t figure it out with the jQuery reference...
Many thanks!
Shpid3r
|
|
|
|
|
It sets the h-accordion to have a style attribute "cursor" set to "pointer" (which obviously sets the mouse cursor to a pointer when mousing over h-accordion). Then, it hides the element following h-accordion.
FYI, it may not be clear if you are new to jQuery, so I thought I'd let you know that jQuery can chain statements. So the above basically looks like this:
$('.h-accordion').click().css().next().hide();
So it gets the elements with the "h-accordion" class, applies a click handler to them, applies some CSS to them, moves to the element following each of them, then hides those following elements.
The click handler will hide/show "following" elements. The "last line" (as you call it) will ensure those "following" elements are initially hidden.
Martin Fowler wrote: Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
|
|
|
|
|
Wow, it makes sense and it's so simple!
Indeed I`m new to jQuery.
Now I`m able to play around with this a bit!
Many thanks!
|
|
|
|
|
how to fire multiple textbox when it is null to summaryvalidator
|
|
|
|
|
$("input:text").each(function()
{
alert("You're FIRED!");
});
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
ghantaanil wrote: how to fire multiple textbox
What do you mean by fire textbox?
|
|
|
|
|
I don't know anything about JavaScript or ECMAScript or ...
I just receive error like javascript:void(0) & in online questionnaire,visited in "http://kicsware.ir/hr/mainAction.do" ,I can't get visibleinput
tanks for help
modified on Sunday, July 24, 2011 8:09 AM
|
|
|
|
|
Do you have a technical question?
The best things in life are not things.
|
|
|
|
|
var classname= "active-k active-t active-o active-c active-v active-x";
var sometext="active-k active-k-background Kommentar";
now i want to match that is sometext contains any of the word in classname then it should return.
what is the best way of matching any of the word in classname [active-k or active-t .....] against sometext
|
|
|
|
|
It sounds as if you may be asking for something like:
var words = classname.split(' ');
for (var item in words) {
if (sometext.indexOf(words[item]) != -1) {
return true;
}
}
return false;
|
|
|
|
|
Hi,
please put how to get file size using javascript without using any third party controls?
|
|
|
|
|
JavaScript in a web page is sandboxed to prevent it from being able to do such things as access the file system. Therefore, the only way to get around this is to use a third party control, or if your app will only run on IE on Windows, you can use the ActiveXObject to create an instance of the Scripting.FileSystemObject and access the file size with that.
|
|
|
|
|
Hey i was designing a website which plays a no of music station live. For this i used the Media Player for website and setted its src ='http://www.bollywoodhungama.com/scripts/bollywoodhungama.asx'
Now i want to have Buttons through javascript and want that if a user click on the buttons than that particular channel should be switched.
<HTML>
<HEAD>
<script type="text/javascript">
function change()
{
window.location.reload();
function chg()
{
document.getElementById("myplayer").setAttribute("src", "mms://216.185.43.237/radiocity 1");
}
}
</script>
</HEAD>
<body>
<embed id="myplayer" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" name="mediaplayer1" showstatusbar="true" enablecontextmenu="false" autostart="false" width="320" height="60" loop="false" src="http://www.bollywoodhungama.com/scripts/bollywoodhungama.asx " />
</embed>
<input type='button' onclick='change()' value='Change'/>
</body>
</HTML>
Here i have used this Change() function to reload the page so that the station should stop playing. and now here i have added function chg() inside this and i want that after reload the src value should get changed and on starting the player another station should start playing.
But this is not working ?
Is it possible to change the src to new value after page reload ?
Please suggest.
All i want is that the "src" value should get change anyhow.....and one should be able to switch playing stations.
|
|
|
|
|
try this
document.getElementById("myplayer").src="Your url";
|
|
|
|
|
Already tried that but not working.
Please help changing play station.
|
|
|
|
|
Hi
window.location.reload()
does this funtion load the html document again ?
if yes, document will be new parsed include javascript ?
does embed support ID or only NAME ?
does "myplayer" have .src allready and you create this attribute again ?
where will function chg() be called ?
onclick
Media Player from Microsoft .... try HTML-5-Media (webM, ogg)
or try Quicktime (if you want go to my webpage www.twseiten.com
for informations).
|
|
|
|
|
I think twseitex is correct, your reload is a short circuit to changing the src value.
Try removing the reload and just setting the src value with the function.
<script type="text/javascript">
function change()
{
document.getElementById("myplayer").setAttribute("src", "mms://216.185.43.237/radiocity 1");
}
</script>
Chris J
www.redash.org
|
|
|
|
|
Error: Access to restricted URI denied" code: "1012 [Break On This Error]
xhttp.send(null);
function getXML(xml_file) {
if (window.XMLHttpRequest) {
var xhttp = new XMLHttpRequest();
}
else {
var xhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET",xml_file,false);
xhttp.send(null);
var xmlDoc = xhttp.responseXML;
return (xmlDoc);
}
I used same code for another page and it worked. But suddenly its giving this error.
I pass projects.xml as xml_file to the function.
Can some tell whats happening?
|
|
|
|
|
Access permissions on the target folder / file, sounds like the problem.
Have you checked the privileges for the end points and compared the one that works with the one that doesn't?
|
|
|
|
|
In my project , For Lower version ie, its not support canvas object so we are using flash canvas separate plugin . its given canvas object for lower version of ie so flash installation is necessary for that. Our problem is how find out flash plugin already installed or nor . if not installed how can installed with in our page. Help me...
Thanks...
|
|
|
|
|
I don't know I am right or not but when you add flash plugin by <object> tag then you can provide installation link when you don't find plugin. It will detect if plugin install or not and if not installed it will show the link where to install it.
I might be wrong but you should search on that may be it help you.
|
|
|
|