?
Solved

stop page from going further javascript

Posted on 2011-10-27
2
Medium Priority
?
286 Views
Last Modified: 2012-05-12
I have the following page:
http://www.themailbox.com/tec/af/page/tec/core/tool/testPdf.do

If I click on "create", it will show alert message, if you click "OK", then it will go to another page show "false", I'd like the page to stay where it was after I click "OK" on the alert message. In Chrome, it's working exactly as it should be, but in IE and firefox, it's not.

How can I do that? Thanks.
function popForm() {
	var words = document.createPdfForm.words.value.split(" ");
	var wordsCnt = words.length;
	var minCnt = 3;
	if ( wordsCnt < minCnt) {
		alert("You only entered " + wordsCnt + " words, enter at least 3 words."); 
		return false;
	} 
	var windowname="newWin";
	window.open('', windowname, 'height=' + (window.screen.height * .75) + ',width=' + (window.screen.width * .50) + ',scrollbars=1, status=0, location=0, menubar=0, toolbar=0');
	$("#createPdfForm").submit();
}

Open in new window

0
Comment
Question by:xiaoyunwu
2 Comments
 
LVL 12

Accepted Solution

by:
zappafan2k2 earned 2000 total points
ID: 37038860
Change the markup from
<a class="toolscreate" href="javascript:popForm()"></a>

Open in new window

to
<a class="toolscreate" onclick="popForm()"></a>

Open in new window

and see what happens.
0
 

Author Closing Comment

by:xiaoyunwu
ID: 37038898
Thanks so much!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question