Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Thursday, December 3, 2009

javascript submitting form twice

I have form with hidden fields. When i do change the country select box, taking the value of select box  & updating  the same in hidden field. When i hit the search button to search countries, i am submitting the form using javascript.

My code:

<a href="#" onclick="submitMyForm();">Search</a>

I was wondering this javascript submitted this form twice. First time with the value in the hidden box and second time with out.

We found out the problem with my javascript code. 

Correct code:

<a href="#" onclick="submitMyForm();return false;">Search</a>

So "return false;" did trick for me.

Have fun

Friday, November 7, 2008

Embed flash in html using javascript

Now a days Web applications embedding flash or video to describe about the stuff. I was came across the scenario where i have to embed flash in my web application.

I found that using javascript is better option.

Find the complete code in the following URL.

http://docs.google.com/Doc?id=dgbxv8m3_0f9znh9d9

This is plain HTML document. One thing you have to take care is source file path. In above URL's document, you could find ####### symbol inside of the body tag.

You have to just replace ####### with your flash file absolute path.
for example...
/home/JP/demo.swf is name of the flash file. ###### should be replace with /home/JP/demo

Have fun.