PDA

View Full Version : Pop-up window in 'crosstick.htm'



ronpaul53
04-15-2009, 02:15 AM
1) Script Title: Pausing up-down scroller

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex2/crosstick.htm

3) Describe problem: I am using this script successfully just as an event scroller with NO links to any external/internal pages, however I would like to incorporate links to internal pages which I am able to do but as these links will be to small pages I would like to have these come up in a 'pop-up' window rather than FULL window/tab etc. I am already using a 'pop-up' window script but don't know how to incorporate it. Anyone have any ideas

ddadmin
04-16-2009, 05:18 AM
There are a few ways to go about this. One elegant solution is to re-route any click action occurring within the scroller, and if it's a link, perform a custom action (such as opening the link in a popup) while disabling the default behavior of following through with the link. Given the below sample initialization code, the added code in red does this:


<script type="text/javascript">

//new pausescroller(name_of_message_array, CSS_ID, CSS_classname, pause_in_miliseconds)

new pausescroller(pausecontent, "pscroller1", "someclass", 3000)
document.write("<br />")
new pausescroller(pausecontent2, "pscroller2", "someclass", 2000)

var myscroller=document.getElementById('pscroller1')
myscroller.onclick=function(e){
var evt=e || window.event
if (!evt.target)
evt.target=evt.srcElement
if (evt.target.tagName=="A")
window.open(evt.target.href) //custom action to perform on clicked link
if (evt.preventDefault) //stop link from following through
evt.preventDefault()
else
return false
}

</script>

You'll want to change the line in red to perform the desired action when a link is clicked on, such as call your popup window function with the passed link.