Hi there guys, I'm new to these modal/pop-up windows and divs... I've been looking around the internet all day, trying to work out how I can integrate a "sign up here for our newsletter" form...into a (modal) pop up... If anyone knows of any tutorials, or can point me in the direction of some code that could help me out, I'd be really thankful. .. Many thanks in advance
Place this on your site's header : <SCRIPT TYPE="text/javascript"> <!-- function popup(mylink, windowname) { if (! window.focus)return true; var href; if (typeof(mylink) == 'string') href=mylink; else href=mylink.href; window.open(href, windowname, 'width=400,height=200,scrollbars=yes'); return false; } //--> </SCRIPT> Code (markup): And include below to trigger the action for pop up window. <A HREF="the link you want to pop up" onClick="return popup(this, 'window_title')">popup</A> HTML:
lastfiend, thanks for your response - which values do I need to substitute in ? I'm not sure what the values are "window name" and "window title" As you may be able to tell, javascript is not my forte - but if you could just clarify the code slightly, im sure i'll be able to get it sorted Also, what is "mylink" ? Is it the url I want to popup? Do I create a seperate .html page that is displayed as the popup? Thanks once again for the help, and my lack of knowledge
The mylink is the text in the quotation above ("the link you want to pop up"). You shouldn't have to change the script posted by last friend much...the only change you'll need to make to make this work is to substitute "the link you want to pop up" with the url you want to show up in the pop-up window. BTW, I'm not sure if your looking specifically for a modal implementation, but the script provided isn't a modal it's a pop-up window.
Ah, I was looking for a modal... I;'ve found a few good looking ones, just not having much luck implementing them and adding in the form. But I'll have to just spend a bit more time getting my head around it I tihnk, and give it a proper go. Thanks anyway
I'm sorry for the late reply. windowname and mylink is the variable in javascript, you can leave it alone. What you need to change is as below like for example : <A HREF="http://forums.digitalpoint.com" onClick="return popup(this, 'Digital Point')">popup</A> HTML: On example above, the statement : HREF="http://forums.digitalpoint", is the URL of window you want to pop up, change it into yours. And 'Digital Point' is what you want the pop up window name to be. Cheers!