Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Javascript Function Help
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

n8pbm
Junior Member

USA
212 Posts

Posted - 15 September 2003 :  20:10:11  Show Profile  Visit n8pbm's Homepage
I know very little about Javascript. So I was taking some of the javascript code from snitz and was playing with how the functions work. I have one piece of information that I can not figure out. I know someone here can help

I want to pass an argument to the function. So my test page calls the function this way:

response.write "<p><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """><a href=""javascript:email_all(" & strTopic & ")"">Click here to send email to the list of attendees.</a></font></p>" & vbNewLine 


Now I am trying to pass the value of the strTopic to the function. I have tried several different variations but here is my last one (Does not work of course)


Response.Write	"    <script language=""JavaScript"" type=""text/javascript"">" & vbNewLine & _
		"    function email_all(strTP){" & vbNewLine & _
		"    	var where_to= confirm(""Do you really want to Send email to all Attendees?"");" & vbNewLine & _
		"       if (where_to== true) {" & vbNewLine & _
		"       	window.location=""eventlist.asp?email="" & strTP & vbNewLine & _
		"       }" & vbNewLine & _
		"    }" & vbNewLine & _
		"    //-->" & vbNewLine & _
		"    </script>" & vbNewLine

so the resulting link should be:
eventlist.asp?email=3
of course the 3 would be whatever the variable is.

Any help?

Thanks

Mike
Great Lakes Pop Up Club Camping

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 15 September 2003 :  20:43:26  Show Profile
and what about it doesn't work? do you get an error? do you have a test page we can see it in action?

the first thing wrong that i see is that this line:

" window.location=""eventlist.asp?email="" & strTP & vbNewLine & _

should probably be this:

" window.location=""eventlist.asp?email=" & strTP & """" & vbNewLine & _

" window.location=""eventlist.asp?email=+strTP""" & vbNewLine & _

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~

Edited by - Nikkol on 15 September 2003 20:59:00
Go to Top of Page

n8pbm
Junior Member

USA
212 Posts

Posted - 15 September 2003 :  20:57:59  Show Profile  Visit n8pbm's Homepage
I do not have a test page you can see. It is on my test server that is not on the web.

However I cannot get the variable to show in the link. I have tried what you have listed above with the same result (and several other variations):

eventlist.asp?email=

I can not get the variable to pass.

Mike
Great Lakes Pop Up Club Camping
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 15 September 2003 :  20:59:25  Show Profile
see the change to my last post.

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

n8pbm
Junior Member

USA
212 Posts

Posted - 15 September 2003 :  21:01:39  Show Profile  Visit n8pbm's Homepage
Wow that was quick

Tried it and now I get:
eventlist.asp?email=+strTP

Mike
Great Lakes Pop Up Club Camping
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 15 September 2003 :  21:01:47  Show Profile
another thing you can do is to do a view source on the page in question to see if the function is actually being written to the page the way you expect it to.

i think what you are doing is confusing the asp/vbscript variables with the javascript variables. on top of that, you are using all response.write to write a javascript function to the page, which is a difficult thing to do.

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 15 September 2003 :  21:04:43  Show Profile
told you it was difficult. you've even got me confused on where to put double quotes.... try this ...

" window.location=""eventlist.asp?email=""+strTP" & vbNewLine & _

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

n8pbm
Junior Member

USA
212 Posts

Posted - 15 September 2003 :  21:09:34  Show Profile  Visit n8pbm's Homepage
Ahh yep that was it. I was using Snitz code as an example so I was following the way Snitz has it written. I should learn javascript without asp first.

Thanks for the quick reply and solution!

Mike
Great Lakes Pop Up Club Camping
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 15 September 2003 :  21:10:34  Show Profile
yuppers.

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.29 seconds. Powered By: Snitz Forums 2000 Version 3.4.07