ASP Hyperlink with Javascript problem...

D

David

Hi,

I have text link on each record displayed. This needs to open a new
small window for entering some data, I cannot seem to fix it ?

Hyperlink Code as is:

..... RS("Manual") & "</td><td><a
href=javascript:eek:nclick=NewWindow('JobSerial.asp?JobNumber=" &
RS("JobNumber") & "', 700, 600)>Create JobSheet</a></TD></TR>"



Javascript function in HEAD as is:

<script LANGUAGE="JavaScript">
<!--//
function NewWindow(pagename, pwidth, pheight) {
if (!pwidth) {
pwidth = 600
}
if (!pheight) {
pheight = 480
}
msgWindow=window.open(pagename,"quality","toolbar=no,width=" + pwidth
+ ",height=" + pheight +
",directories=no,status=no,scrollbars=yes,resizable=no,menubar=no");
}
//-->
</script>

_____________________________

Please let me know what I have done wrong.


David
 
J

Jeff Cochran

I have text link on each record displayed. This needs to open a new
small window for entering some data, I cannot seem to fix it ?

Hyperlink Code as is:

.... RS("Manual") & "</td><td><a
href=javascript:eek:nclick=NewWindow('JobSerial.asp?JobNumber=" &
RS("JobNumber") & "', 700, 600)>Create JobSheet</a></TD></TR>"



Javascript function in HEAD as is:

<script LANGUAGE="JavaScript">
<!--//
function NewWindow(pagename, pwidth, pheight) {
if (!pwidth) {
pwidth = 600
}
if (!pheight) {
pheight = 480
}
msgWindow=window.open(pagename,"quality","toolbar=no,width=" + pwidth
+ ",height=" + pheight +
",directories=no,status=no,scrollbars=yes,resizable=no,menubar=no");
}
//-->
</script>

_____________________________

Please let me know what I have done wrong.

Posted a client-side Javascript question in a server-side ASP group.
Try a JavaScript group to help you code however you wish this to
happen.

Jeff
 
D

David Gordon

Jeff,

This is an ASP question. I'm trying to get the Javascript working with
my ASP script....hence my posting on the ASP Group.

If it was straight javascript fair enough.....but it is not.

I'm writing out records via asp, and cannot get the link working within
my ASP CODE.

Please read my post again before trying to tell people off.


David.
 
J

Jeff Dillon

Shouldn't it be <% =RS("JobNumber") %>?

Are you forgetting the <% %> tags?

Jeff
 
P

Paul Baker [MVP, Windows - SDK]

I think so! Look at the HTML source using View Source.

If the source looks incorrect (and I think it does), then it's an ASP
question. If the source looks correct and the JavaScript doesn't do what you
want, then it's a JavaScript problem.

I think you might be getting ASP and JavaScript a tad mixed up.

Paul
 
S

Steven Scaife

Your best bet is probably viewing the source when the page loads this will
give you a better idea of whats wrong, maybe its the case of something in
the statement. Viewing what the browser returns though would be your best
bet
 
M

MikeT

Hi,

I have text link on each record displayed. This needs to open a new
small window for entering some data, I cannot seem to fix it ?

Hyperlink Code as is:

.... RS("Manual") & "</td><td><a
href=javascript:eek:nclick=NewWindow('JobSerial.asp?JobNumber=" &
RS("JobNumber") & "', 700, 600)>Create JobSheet</a></TD></TR>"

You've left off the quotes around the href, so the ' and the
spaces in the javascript are confusing the browser.

Try the following:

.... RS("Manual") & "</td><td><a
href=""JobSerial.asp?JobNumber=" & RS("JobNumber") & """ target=""_blank""
onclick=""return NewWindow('JobSerial.asp?JobNumber=" &
RS("JobNumber") & "', 700, 600)"">Create JobSheet</a></TD></TR>"

<script type="text\javascript">
function NewWindow(pagename, pwidth, pheight) {
if (!pwidth) {
pwidth = 600
}
if (!pheight) {
pheight = 480
}
msgWindow = window.open(pagename,"quality","toolbar=no,width=" + pwidth
+ ",height=" + pheight +
",directories=no,status=no,scrollbars=yes,resizable=no,menubar=no");
}
return !msgWindow;
</script>

Note the changes to the javascript so that it returns whether the window
actually got created or not.

However, this is all clientside stuff and not ASP :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,901
Members
47,439
Latest member
elif2sghost

Latest Threads

Top