PDA

View Full Version : popup url on submit question



doveroh
01-31-2011, 03:59 AM
What I am looking to do is have 4 different check boxes, one for each different site. For Example:

checkbox1 (if checked would popup) www.site1.com
checkbox2 (if checked would popup) www.site2.com
ect.

When the user clicks the submit button each site that is check marked would popup in a different window.

Anyone have any ideas on how to do this? An example site I came across was tripmama.com

Thank you in advance.

doveroh
01-31-2011, 05:41 AM
this is what i am kind of looking for: http://www.tripmama.com/default.aspx?tabid=193&fc=oma&dd=2/10/2011&tc=cle&rd=2/15/2011&tt=2&at=1&ct=0

Philip M
01-31-2011, 07:58 AM
Like this?


Google <input type = "checkbox" id ="chk1" onclick = "gosite(1)">
Coding Forums <input type = "checkbox" id ="chk2" onclick = "gosite(2)">
Javascript Kit <input type = "checkbox" id ="chk3" onclick = "gosite(3)">
Yahoo <input type = "checkbox" id ="chk4" onclick = "gosite(4)">

<script type = "text/javascript">

function gosite(which) {
if (which == 1) {URL = "http://www.google.com"; var leftval = "50"; var topval = "50"}
if (which == 2) {URL = "http://www.codingforums.com"; var leftval = "100"; var topval = "100"}
if (which == 3) {URL = "http://www.javascriptkit.com"; var leftval = "150"; var topval = "150"}
if (which == 4) {URL = "http://www.yahoo.com";var leftval = "200"; var topval = "200"}
var htval = 600;
var widval = 600;
Popup(URL, htval, widval, leftval, topval ); return false; target="_blank";
}

function Popup(url, height, width, leftval, topval ){
var windowProperties = "toolbar=0, scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+ width+",height="+height+",top= "+topval+", left="+leftval+" ";
return window.open(url, "", windowProperties );
}

</script>


"A man would do nothing, if he waited until he could do it so well that no one at all would find fault with what he has done." - Cardinal Newman

doveroh
01-31-2011, 01:30 PM
something like that, but all the checkmarked options popup once the user hits a submit button

Thank you for this.

Philip M
01-31-2011, 03:19 PM
<form name = "myform">
Google <input type = "checkbox" name ="chk1" >
Coding Forums <input type = "checkbox" name ="chk2" >
Javascript Kit <input type = "checkbox" name = "chk3" >
Yahoo <input type = "checkbox" name ="chk4" >
<br><br>
<input type = "button" value = "Click to pop-up selected sites" onclick = "gotosites()">
</form>

<script type = "text/javascript">
function gotosites() {

for (var i=1; i<5; i++) {
if (document.myform['chk' + i].checked) {
var x = i;
if (x == 1) {URL = "http://www.google.com"; var leftval = "50"; var topval = "50"}
if (x == 2) {URL = "http://www.codingforums.com"; var leftval = "100"; var topval = "100"}
if (x == 3) {URL = "http://www.javascriptkit.com"; var leftval = "150"; var topval = "150"}
if (x == 4) {URL = "http://www.yahoo.com";var leftval = "200"; var topval = "200"}
var htval = 600;
var widval = 600;
Popup(URL, htval, widval, leftval, topval ); target="_blank";
}
}

}

function Popup(url, height, width, leftval, topval){
var windowProperties = "toolbar=0, scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+ width+",height="+height+",top= "+topval+", left="+leftval+" ";
return window.open(url, "", windowProperties );
}

</script>

doveroh
02-11-2011, 04:17 AM
Ok, so I need something new now, I need it to popup with a one web site (a pop behind window) when they check mark a box and that closes one they hit the submit button and the new popup window shows the actual site. I know this kinda sounds confusing. I am looking to do something like tripmama.com has on their site. Thanks in advance!!

Philip M
02-11-2011, 08:39 AM
I know this kinda sounds confusing.

Yes, it does indeed. :) If you can spell out what you want coherently it may be possible to assist you - but have you made any effort to do this yourself?