...

View Full Version : javascript function not working



o0O0o.o0O0o
04-24-2008, 04:32 AM
hi ,



function markpayment(orderNumber)
{

alert();


}


this is not working


onclick='javascript:markpayment('".$ordernum."_tick');'

but this is working



onclick='javascript:markpayment(".$ordernum.");'

shyam
04-24-2008, 05:10 AM
it does not matter what it looks like in php...as long as some valid html is generated it will work...you have to show us the generated the html or the complete echo statement from php

o0O0o.o0O0o
04-24-2008, 05:35 AM
I saw the html it was


markpayment('23434_tick') it was not working

but


markpayment(23434)

was working

I think problem was when i added tick with it . I later on concatenated tick in the function and then it worked but not when i joined it with in function arguments

shyam
04-25-2008, 07:09 PM
markpayment('23434_tick') it was not working
but

markpayment(23434)
was working


they're both no different and should work...maybe you are looking in the wrong place...are you sure there isn't some validation that checks if the incoming argument is an integer or something?

sobrien79
04-25-2008, 08:26 PM
Change:

function markpayment(orderNumber) {
alert(orderNumber);
}

The problem is that the browser sees the onclick event as markpayment( not onclick='markpayment('23434_tick')' because of how many quotes you have.

Change the output so that it looks like:


onclick="markpayment('23434_tick')"



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum