Jump to content

[SOLVED] Function parameter help.


pocobueno1388

Recommended Posts

I have this function:

 

function showImage(id) {
window.open( "inventory.php?itemID=id", "showImage", 
"status = 1, height = 350, width = 400, resizable = 0" )
}

 

I am calling the function like so:

 

<td onClick='showImage(1)'><a href="###">Link</a></td>

 

But the "1" I am setting as the parameter for "id" is not working.

 

It is supposed to pop up with the URL:

inventory.php?itemID=1

 

Instead it is coming up with:

[tt]inventory.php?itemID=id

 

and not processing the "id" parameter as a variable.

 

Here is the line that is obviously causing the problem:

window.open( "inventory.php?itemID=id", "showImage", 
"status = 1, height = 350, width = 400, resizable = 0" )

 

Any help is greatly appreciated, thanks =D

Link to comment
https://forums.phpfreaks.com/topic/59831-solved-function-parameter-help/
Share on other sites

window.open( "inventory.php?itemID=id", "showImage", 
"status = 1, height = 350, width = 400, resizable = 0" )

 

Your first parameter having problems. Should be:

window.open("inventory.php?itemID=" + id, ....);

 

You had mixed up the variable inside the string.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.