robert
robert

Reputation: 625

quotes in javascript function

I need a bit of help with quotes in javascript function

function jsNewWindow(value){
        //window.open ("http://www.javascript-coder.com","mywindow"); 
        window.open("rpt_Distance.php?POST_IN1="+value+","mywindow","width=800,height=600") ;
    }

thanks!

Upvotes: 1

Views: 383

Answers (5)

Matthew Vines
Matthew Vines

Reputation: 27561

"rpt_Distance.php?POST_IN1=" + value, "mywindow", "width=800,height=600"

Upvotes: 3

Serge Meunier
Serge Meunier

Reputation: 162

This code should read to be correct - leaving out the +" after value

function jsNewWindow(value){
    //window.open ("http://www.javascript-coder.com","mywindow"); 
    window.open("rpt_Distance.php?$POST_IN1="+value,"mywindow","width=800,height=600") ;
}

Upvotes: 1

Romain Linsolas
Romain Linsolas

Reputation: 81577

You have one +" that must be removed:

window.open("rpt_Distance.php?$POST_IN1="+value+","mywindow","width=800,height=600") ;

must be replaced by:

window.open("rpt_Distance.php?$POST_IN1="+value,"mywindow","width=800,height=600") ;

Upvotes: 1

josh.trow
josh.trow

Reputation: 4901

It helps if you ask a question, not just post a snippet function. Are you trying to insert actual quotes? If so escape them with '\'.

EDIT: Hats off to Shoban for being able to read minds (and code) :).

Upvotes: 1

Shoban
Shoban

Reputation: 23016

function jsNewWindow(value){
        //window.open ("http://www.javascript-coder.com","mywindow"); 
        window.open("rpt_Distance.php?$POST_IN1="+value,"mywindow","width=800,height=600") ;
    }

I just removed +"

Upvotes: 1

Related Questions