 |
| Javascript How-To Ask your "How do I do this with Javascript?" questions here. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

October 18th, 2005, 06:35 PM
|
|
Authorized User
|
|
Join Date: Oct 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The link is dynamic. I really need to get onto the server so I can see how he put that code in my Javascript. I am having trouble connecting to his server with the info he gave me.
Thanks for the help, I just wish I could give you a straight answer on this. I think the VBS script-link-thing needs to run outside of the Jscript.
|
|

October 19th, 2005, 03:53 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
If the page is run on a webserver that processes the asp, everything should work ok.
The VBScript will be processed before the javascript is written to the page, so the link should get rendered as required.
|
|

October 19th, 2005, 10:55 AM
|
|
Authorized User
|
|
Join Date: Oct 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
It seems that the quotes are what screws it up, When the open quotes start the html expression, they close out before the 'courseID' variable. I think thats why its not being processed first.
Will having something like this work?>
var linkPage = course.asp?courseID=<%=(courseContent...
~~~~~
function GoToURL(){
if (self.status=="OK to proceed!")
{
open("linkPage","_self")
}else....
Or do I have to change the syntax in the "open("linkPage"... part?
|
|

November 2nd, 2005, 01:08 PM
|
|
Authorized User
|
|
Join Date: Oct 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ok, we tried the last bit o code and that does not work either.
Any ideas?
|
|

November 2nd, 2005, 01:11 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
linkPage is a variable, so you don't need it in quotes...
Code:
open(linkPage, "_self")
|
|

November 4th, 2005, 05:45 PM
|
|
Authorized User
|
|
Join Date: Oct 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ok, still not working.
I got an idea though. I posted the code for the ASP page it goes in so you can see it in its native location.
http://www.schumannmedia.com/webImages/htmlvbs.html
That may give a clearer picture to what may be causing this not to work.
Thanks for all of the input, this site rocks.
|
|

November 5th, 2005, 02:26 PM
|
|
Authorized User
|
|
Join Date: Oct 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ok, now I am getting whats going on.
The code in this variable breaks the Javascript;
var nextPage = course.asp?courseID=<%=(courseContent.Fields.Item( "courseID").Value)%>&chapterNum=<%=(courseContent. Fields.Item(//"chapterNum").Value)%>&contentSection=<%=(courseCo ntent.Fields.Item("forwardSection").Value)%>
I did find that the output in the source file now reads:
var nextPage = course.asp?courseID=300&chapterNum=1&contentSectio n=2
var nextTest = chapterTest.asp?courseID=300&chapterNum=1
..so it means it is doing what it is supposed to be doing but it breaks the Javascript somehow.
Now I am really stumped
|
|

November 5th, 2005, 08:29 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
This is not valid JavaScript:
var nextPage = course.asp?courseID=300&chapterNum=1&contentSectio n=2
Change the ASP code so the JavaScript ends up like this:
var nextPage = 'course.asp?courseID=300&chapterNum=1&contentSecti on=2';
HtH,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

November 7th, 2005, 03:18 PM
|
|
Authorized User
|
|
Join Date: Oct 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
:D Rock, Rock on! :D
|
|
 |