tags:

views:

50

answers:

2
<script type="text/javascript">


function openpopup(pop){
  var pop1=window.open(this.pop , "", "width="+(screen.width-10)+", height="+(screen.height-10)+",hotkeys=no,scrollbars=yes");

}
</script>

<a href ='#' onClick="javascript:openpopup(showLongMessage.this)">Show More </a>

IT gives the following error No route matches "/undefined" with {:method=>:get}

A: 

You have to specify the url of the page you want to open in your popup.

window.open('http://www.mydomain.com/mypopuppage.html','name','height=200,width=150')

I bet in your current code

this.pop

returns 'undefined'

Peter
A: 

Href can contain javascript that will be executed in context of opened window:

<script type="text/javascript">
function openpopup(pop){
  var escaped = pop.replace(/"/g, "&quot;").replace(/'/g, "\\'");
  var pop1=window.open("javascript:document.write('" + escaped + "');document.close();",
  "", "width="+(screen.width-10)+",height="+
  (screen.height-10)+",hotkeys=no,scrollbars=yes");
}
</script>
<a href="#" onclick="openpopup('some \'long\' &quot;text&quot;');return false;">
  Show More
</a>

But it is not a good way to make popups. Consider studying and using exising library. jQuery for example has nice Dialog functionality.

Sasha Yanovets