Skip to main content
Inspiring
August 13, 2007
Question

How to pass url varible in JS?

  • August 13, 2007
  • 1 reply
  • 266 views
I want to replace this link with a javascript window.open
<a href="edit_frm.cfm?id=#id#" target="_blank">



How can i pass url varible in JS?.
<script Language="JavaScript">
var openWin = null;
function winOpen(){
openWin = window.open('add_frm.cfm?id=<cfoutput>#id#</cfoutput>','addWin','width=400,height=300,scrollbars=yes,menubar=no,status=no,location=no');
}
</script>
-----------
code to call JS
<a href="javascript:winOpen()" target="_blank">
    This topic has been closed for replies.

    1 reply

    Inspiring
    August 14, 2007
    there are a lot of books and free online resources that will help you
    learn the basics of js:

    in the script:

    function winOpen(mycfid){
    openWin =
    window.open('add_frm.cfm?id=' + mycfid + '','addWin','width=400,heigh
    t=300,scrollbars=yes,menubar=no,status=no,location=no');
    }

    in the link code:

    javascript:winOpen(<cfoutput>#id#</cfouptut>)

    --

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com