Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
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
 
Old October 18th, 2005, 06:35 PM
1up 1up is offline
Authorized User
 
Join Date: Oct 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

 
Old October 19th, 2005, 03:53 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

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.

 
Old October 19th, 2005, 10:55 AM
1up 1up is offline
Authorized User
 
Join Date: Oct 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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?

 
Old November 2nd, 2005, 01:08 PM
1up 1up is offline
Authorized User
 
Join Date: Oct 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, we tried the last bit o code and that does not work either.

Any ideas?

 
Old November 2nd, 2005, 01:11 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

linkPage is a variable, so you don't need it in quotes...
Code:
open(linkPage, "_self")
 
Old November 4th, 2005, 05:45 PM
1up 1up is offline
Authorized User
 
Join Date: Oct 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

 
Old November 5th, 2005, 02:26 PM
1up 1up is offline
Authorized User
 
Join Date: Oct 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old November 5th, 2005, 08:29 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
 
Old November 7th, 2005, 03:18 PM
1up 1up is offline
Authorized User
 
Join Date: Oct 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

:D Rock, Rock on! :D






Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Connection using VBScript (or) JavaScript reachsevar ASP.NET 1.0 and 1.1 Basics 1 November 27th, 2007 10:54 AM
JavaScript to VBScript Thomas82 Classic ASP Basics 1 July 29th, 2006 07:03 PM
Using VBScript variables in Javascript PL Classic ASP Basics 4 July 29th, 2004 03:05 PM
vbscript and javascript together erin VBScript 1 October 21st, 2003 02:48 PM
Using VBScript and JavaScript together jwalborn Classic ASP Professional 2 October 13th, 2003 10:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.