...

View Full Version : Javascript Pop up function



dupps1
06-28-2004, 03:40 PM
Hi guys...

I am trying to create a pop up function and presently i have this below code but it does not seem to work and i get the "Error on page" error displayed whenever i click the link...

Here is my code...

**********************

""<a href='#' onclick='mypopupfunction("&rsitem("Itemnum")&");' title=""""" & (comments) & """""> " & RSitem("Itemname") & "</a>"")

<script language="javascript">
function mypopupfunction(itemidArg)
{
winvar = window.open('popupcomments.asp?itemnum='+itemidArg,'comments','menubar=no,scrollbars=no,resizable=ye s,width=200,height=200');
}
</script>

**********************

Thanks in advance....

homerUK
06-28-2004, 03:45 PM
looking at the code it's something to do with the line

""<a href='#' onclick='mypopupfunction("&rsitem("Itemnum")&");' title=""""" & (comments) & """""> " & RSitem("Itemname") & "</a>"")

why are there speech marks around it? I assume its possibly being outputted by some other code?

jbot
06-28-2004, 03:49 PM
""<a href='#' onclick='mypopupfunction("&rsitem("Itemnum")&");' title=""""" & (comments) & """""> " & RSitem("Itemname") & "</a>"")

wot the heck is this?

you've got waaaaay to many quotation chars in there, making it impossible to disassemble. and they're also the most likely cause.

does the error msg say "unterminated end of string...", per chance?

dupps1
06-28-2004, 03:50 PM
yes...I just pasted the part which shows the onclick event....

Thanks

dupps1
06-28-2004, 03:51 PM
hmm...sorry guys for the confusion...here is the complete line of code and extra quotation marks are just the part of the other code

Execute(dayname(rsitem("Menudate")) & " = AddToArray(" & dayname(rsitem("Menudate")) & ",""<a href='#' onclick='mypopupfunction("&rsitem("Itemnum")&");' title=""""" & (comments) & """""> " & RSitem("Itemname") & "</a>"")")


Thanks...

dupps1
06-28-2004, 04:03 PM
i am not getting any error messages like "Unterminated String... "...

but at the bottom of the page i am getting this message "Done, but with errors on page"

thanks

jbot
06-28-2004, 04:18 PM
i am not getting any error messages like "Unterminated String... "...

but at the bottom of the page i am getting this message "Done, but with errors on page"


if you double click that message, you'll get the real error!!

:p

dupps1
06-28-2004, 04:35 PM
Ok...i double clicked the error and got the message "Expected End of Statement" and it is referring to some line below the above excute statement where i wrote comments...

Thanks

jbot
06-28-2004, 04:41 PM
it is referring to some line below the above excute statement where i wrote comments...


how do you know this?

is this page being parsed by ASP, per chance?

dupps1
06-28-2004, 04:43 PM
Yes...its an ASP page...and when i clicked the error message...i got the line number and Expected End statement message..

Thanks

jbot
06-28-2004, 04:55 PM
the problem is in the ASP, not the JS as such.

I take it the ASP is written in VBS? must be, since you're using the ampersands instead of plus signs for string concatenation.

basically, these are being parsed out by the ASP, as is the function to be called.

another point to note is that single quotations are comment delimiters. that is to say, anything which proceeds them is commented out. this is also part of the problem.

you need to recode the ASP part first, since this is what's wrong.

btw: is this for a commercial project or an educational one?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum