During development involving user registeration , you might want to display a drop down list of all countries for the user to chose from , but writing all that code for ( <select><option….. ) for 140+ countries can be a tidious and frustrating task , so here is the code for HTML drop down menu of all countries . The 140+ countries Continue Reading
A problem with float and clear that drove me crazy!
Yesterday i had submitted this wordpress theme of mine to the official wordpress theme directory. I got a feedback from the guys there stating that my theme wasnt valid as it had some issues and they asked me to fix them and upload again. I was able to fix all the issues but one, ant that was : the gallery, when inserted in the post, streches out the gallery container div to around 600px! I looked at the source code of the gallery and found that the gallery was created using the dt and dl tags, and the dt containing the images was set to float to left using css and each row of dt containing images was separated out by a br styled to clear:both. This was the part of document which was causing trouble, the br tag, after clearing both side was pushing down the next row of images to at least around 600px, trying to fix this issue only had me panicking after hours of debugging,re-writing some styles and googling the solution out, but in vain
. It was when i was almost exhausted and felt like my brain was going to give up and shutdown that i told myself to give it a last try , i just gave my content div (which was set to float to left and was the parent of the post div that was streching out) a fixed width of 740px, and hurray, to my amazement i found that the problem was solved!!!
. I dont know what actually happened, what had the width of the parent element to do with the vertical stretchning of the gallery image rows. So if you have an explanation then please lemme know in the comments below.
My first web portfolio
Today i’ve launched my new website and my first web portfolio.
You can check it out here: www.dynamicguru.com/mujtaba/ .
The site is one of my best works till date and is the first site of mine to use ajax and is powered by jQuery. The site uses awesome jQuery effects for page transitions. Also it has validated XHTML 1.0 Strict markup. Check it out and tell me in the comments what you think about it?
Javascript quadratic equation solver
Here is a simple javascript that solves quadratic equations of the form ax²+bx+c = O. You just have to specify the values of a ,b and c and the script then calculates the two real roots alpha(x1) and beta (x2) of the equation. The script also tells you if the equation has a real root or not, depending upon the value of D (Discriminant). The equation is solved using the quadratic formula x = -b±(b²-4ac)½/2a .
The script is located here ->http://www.dynamicguru.com/files/quadratic_equation.html
Here is the source code of the script :
//Place this within the section <script type="text/javascript">< function calculate() { var a=prompt("enter value of a"); var b=prompt("enter value of b"); var c=prompt("enter value of c"); var a2=2*a; var ac=4*a*c; var dis=b*b; var dis=dis-ac; if(dis<0){ document.getElementById('Equation').innerHTML='No real roots exist since Discriminant < 0 !<br />D = ' + dis + ' <br />The Equation = ' + a + 'x² + ' + b + 'x + ' + c + '<br />'; document.getElementById('x1').innerHTML=' '; document.getElementById('x2').innerHTML=' '; } else{ var dis_sqrt=Math.sqrt(dis); var x1=-b+dis_sqrt; var x1=x1/a2; var x2=-b-dis_sqrt; var x2=x2/a2; document.getElementById('Equation').innerHTML=" Equation = " + a + "x² + " + b + "x + " + c + "<br />"; document.getElementById('x1').innerHTML=' Alpha (x1) = ' + x1; document.getElementById('x2').innerHTML=' Beta (x2) = ' + x2; } } </script> //Place this within the section: <h1><a onclick="calculate()" href="#"> Click to solve »»</a></h1> <div id="Equation"></div> <div id="x1"></div> <div id="x2"></div>
How to change cursors on web pages
The “cursor” property of css allows you to change the mouse cursor either for the complete page or for specific elements
The following example illustrates the use of the “cursor” property of css:
//This changes the cursor for the complete page body { cursor:url(cursor.cur); } //This changes the cursor only for the element of class fancy .fancy{ cursor:url(fancy_cursor.ani); }
Cursors are files with extension .cur or .ani (for animated cursor ),there are many sites which give you free animated and non animated cursors for download, even there are freewares which let you create your own custom cursors.
Furthermore, instead of specifying the url of the cursor file you can specify the type/style of cursor which comes inbuilt on most systems.
For example, cursor:pointer will cause the cursor to change to a pointer (as on hyperlinks) and cursor:help will give you a small question mark.
Below is a complete list of the cursor types you can use, move the cursor over a word to see it change
Auto
Crosshair
Default
Pointer
Text
Wait
Help
Move
E-resize
N-resize
NW-resize
SE-resize
SW-resize
S-resize
W-resize






