PDA

View Full Version : how to make the pop up window work after clicking submit button?



blankibaby
07-07-2005, 06:28 PM
Hi there, i need someone to help me and guide me on how to
modify the code below. I am making a contact form whereby
after the user click the submit button, a popup nice window will
show and notify the user that his/her enquiry has been received.

Now the problem is, i am using a dhtml popup window script
that will display the popup when you open up this contact form.
But now it will display even before the user submit the form.
Instead I want it to appear only once after user click submit button.
Can somone one here guide me how to do it and look through my
script coding please? :o

Here's the link to my form < contact form (http://blankiblue.com/pxj/contact00.htm) >

jscheuer1
07-07-2005, 08:13 PM
I can probably get back to you later with more details, for one thing, don't launch it onload.

blankibaby
07-08-2005, 06:10 AM
hi~! :)

is this the section where should i change it? [highlighted in red below.]
I remove the onload and it works but it doesnt work for after clicking submit
button. The dhtml window won't appear.




function initfunction(){
setTimeout("displayfadeinbox()", 100)
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = ""
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}

return returnvalue;
}
if (displaymode=="oncepersession" && get_cookie("fadedin")=="" || displaymode=="always" || parseInt(displaymode)!=NaN && random_num==0){
if (window.addEventListener)
window.addEventListener("load", initfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", initfunction)
}
</script>

jscheuer1
07-08-2005, 07:20 AM
I'm not sure how this will work live but, locally it did the trick. Change:

if (displaymode=="oncepersession" && get_cookie("fadedin")=="" || displaymode=="always" || parseInt(displaymode)!=NaN && random_num==0){to:

if (((displaymode=="oncepersession" && get_cookie("fadedin")=="" || displaymode=="always" || parseInt(displaymode)!=NaN && random_num==0))&&(location.href.indexOf('&')!==-1)){and get rid of this:

onsubmit="openpopup()"

blankibaby
07-08-2005, 09:06 AM
hi john, thank you ~!(^ ^)
however, i still have one more problem, after changing the code, the pop up
dhtml window won't display after clicking submit button.

jscheuer1
07-08-2005, 10:59 AM
I just retested using your online example and applying my modifications as I laid them out. It works here. I also tested the live page, and from its behavior, it should work live as well. Were you applying my modifications to a page that is different than the live one you supplied a link to in one of your previous posts? One final thing the modifications in my previous post are the only modifications needed, forget about what I said before that, when I was in a big hurry.

blankibaby
07-08-2005, 03:25 PM
hi john~!

i went through my coding and i realized i didn't remove the
method="post" under the body tag (>_<)
which i added in earlier on later today after uploaded my question(>_<)~~
that's why is not working and i have remove it and it works now(^ ^)
*yay thank you~!*

errm... however, provided if i don't want to remove the method="post" is there another way to have this dhtml
window pop up after clicking submit button?

And lastly, which part of the scripting that allow me to reposition
the dhtml pop up window as i would like it to be else where which is
not too near the contact form's select button as i just realized that
the layer will be overlap/hidden at the back ....

thanks again very much! :)