Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple scripting languages.

Status
Not open for further replies.

dannyd

IS-IT--Management
Apr 30, 2002
8
CA
I have an ASP page in which I am trying to have 2 different scripting languages. I have a javascript in my header and some vbscripting after the header. Each script works as long as the other type is not on the page. Once both are incorporated into the page, only the first on the page will execute and the other will give me an error.

Can we have multiple scripting languages on the same page? And if we can, what am I doing wrong?
 
are both the scripts working server side or is the javascript working client and the vbscript server?
If they are both on the client side then as long as they are within their own <script> tags it should work properly. If they are server side then that may be where you are running into problems. Post the code!!! [bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
Here's a copy of the code. Thanks for the help.

<html>
<head>
<%
function checkbrowser
Set check = server.createObject(&quot;MSWC.BrowserType&quot;)
if check.browser=&quot;IE&quot; and check.version >= &quot;4.0&quot; Then
checkbrowser = &quot;DropStyle&quot;
Else
checkbrowser = &quot;&quot;
End if
End function
%>

<title>Imalog, la puissance dans le traitement des eaux...</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>

<script language=&quot;JavaScript&quot;>
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a.indexOf(&quot;#&quot;)!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
}
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf(&quot;?&quot;))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_nbGroup(event, grpName) { //v3.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == &quot;init&quot; && args.length > 2) {
if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
nbArr[nbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args)) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
} else if (event == &quot;over&quot;) {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args)) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1];
nbArr[nbArr.length] = img;
}
} else if (event == &quot;out&quot; ) {
for (i=0; i < document.MM_nbOver.length; i++) {
img = document.MM_nbOver; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
} else if (event == &quot;down&quot;) {
if ((nbArr = document[grpName]) != null)
for (i=0; i < nbArr.length; i++) { img=nbArr; img.src = img.MM_up; img.MM_dn = 0; }
document[grpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args)) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
}
//-->
</script>


<script language=&quot;JavaScript&quot; fptype=&quot;dynamicanimation&quot;>
<!--
function dynAnimation() {}
function clickSwapImg() {}
//-->
</script>

<script language=&quot;JavaScript1.2&quot; fptype=&quot;dynamicanimation&quot; src=&quot;../../../animate.js&quot;>
</script>

</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot; link=&quot;#CC0000&quot; vlink=&quot;#660000&quot; alink=&quot;#FF0000&quot; leftmargin=&quot;0&quot; topmargin=&quot;0&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; onLoad=&quot;MM_preloadImages('../../../images/nav_en/acc-o.gif','../../../images/nav_en/prof-o.gif','../../../images/nav_en/prod-o.gif','../../../images/nav_en/join-o.gif','../../../images/nav_en/eng-o.gif')&quot; background=&quot;../../../images/bg-goute.gif&quot;>
<table width=&quot;760&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; height=&quot;80&quot;>
<tr>
<td width=&quot;300&quot;><img src=&quot;../../../images/nav_fr/logo.gif&quot; width=&quot;300&quot; height=&quot;80&quot;></td>
<td><img src=&quot;../../../images/nav_en/slogan.gif&quot;></td>
</tr>
</table>
<table width=&quot;760&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; height=&quot;100%&quot;>
<tr>
<td width=&quot;205&quot; valign=&quot;top&quot; background=&quot;../../../images/bg-menu.gif&quot;>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; height=&quot;133&quot;>
<tr>
<td>
<a onMouseOver=&quot;document['fpAnimswapImgFP1'].imgRolln=document['fpAnimswapImgFP1'].src;document['fpAnimswapImgFP1'].src=document['fpAnimswapImgFP1'].lowsrc;&quot; onMouseOut=&quot;document['fpAnimswapImgFP1'].src=document['fpAnimswapImgFP1'].imgRolln&quot; href=&quot;../Company/intro.html&quot;>
<img name=&quot;fpAnimswapImgFP1&quot; src=&quot;../../../images/nav_en/acc.gif&quot; border=&quot;0&quot; onLoad=&quot;&quot; id=&quot;fpAnimswapImgFP1&quot; dynamicanimation=&quot;fpAnimswapImgFP1&quot; lowsrc=&quot;../../../images/nav_en/acc-o.gif&quot;></a></td>
</tr>
<tr>
<td>
<a href=&quot;../Company/profile.html&quot; onMouseOver=&quot;MM_nbGroup('over','profil','../../../images/nav_en/prof-o.gif','',1)&quot; onMouseOut=&quot;MM_nbGroup('out')&quot;>
<img name=&quot;profil&quot; src=&quot;../../../images/nav_en/prof.gif&quot; border=&quot;0&quot; onLoad=&quot;&quot;></a></td>
</tr>
<tr>
<td>
<a href=&quot;../Products/pro_ser.asp&quot; onMouseOver=&quot;MM_nbGroup('over','produits','../../../images/nav_en/prod-o.gif','',1)&quot; onMouseOut=&quot;MM_nbGroup('out')&quot;>
<img name=&quot;produits&quot; src=&quot;../../../images/nav_en/prod.gif&quot; border=&quot;0&quot; onLoad=&quot;&quot;></a></td>
</tr>
<tr>
<td>
<a href=&quot;../../Menu/Contact/contact.html&quot; onMouseOver=&quot;MM_nbGroup('over','joindre','../../../images/nav_en/join-o.gif','',1)&quot; onMouseOut=&quot;MM_nbGroup('out')&quot;>
<img name=&quot;joindre&quot; src=&quot;../../../images/nav_en/join.gif&quot; border=&quot;0&quot; onLoad=&quot;&quot;></a></td>
</tr>
<tr>
<td background=&quot;../../../images/bg-menu.gif&quot; height=&quot;24&quot;>
<a onMouseOver=&quot;MM_nbGroup('over','english','../../../images/nav_en/eng-o.gif','',1)&quot; onMouseOut=&quot;MM_nbGroup('out')&quot; href=&quot;../../../fr/Menu/Products/pro_ser.asp&quot;>
<img name=&quot;english&quot; src=&quot;../../../images/nav_en/eng.gif&quot; border=&quot;0&quot; onLoad=&quot;&quot;></a></td>
</tr>
</table>
<img src=&quot;../../../images/nav_fr/menu.gif&quot; border=&quot;0&quot; name=&quot;menu&quot; width=&quot;205&quot; height=&quot;83&quot;>
</td>
<td rowspan=&quot;2&quot; valign=&quot;top&quot; align=&quot;left&quot;>

<SCRIPT LANGUAGE=vbscript>
Sub ShowProduct
window.open &quot;/documents/products/images/&quot;+product_form.proName.value
End Sub
</SCRIPT>

<%
Set DBObj = Server.CreateObject(&quot;ADODB.Connection&quot;)
DBObj.Open &quot;Imalog-DB&quot;
SQLQuery = &quot;SELECT * FROM Products&quot;
Set RSProducts = DBObj.Execute(SQLQuery)
%>

<H1><font size=&quot;5&quot;><i>Please select a product to view information</i></font></H1>

<form name = &quot;product_form&quot;>
<p>
<select name=&quot;proName&quot; size=&quot;1&quot; onChange = &quot;ShowProduct&quot;>
<OPTION value=&quot;&quot;>Please Select a Product</OPTION>
<OPTION value=&quot;&quot;>-----------------------</OPTION>
<% Do While Not RSProducts.EOF %>
<option value=&quot;<%=RSPRoducts(&quot;proPage&quot;)%>&quot;><%=RSPRoducts(&quot;proName&quot;)%></option>
<%
RSProducts.MoveNext
Loop
DBObj.Close
%> </select></p>
</form>

<p align=&quot;left&quot; style=&quot;margin-left: 10; margin-top: 20; margin-bottom: 20&quot;>&nbsp;</p>
</td>
</tr>
</table>
</BODY>
</HTML>
 
don't you love the bug
try adding this
<%@ Language=VBScript %>
<%
function checkbrowser
Set check = server.createObject(&quot;MSWC.BrowserType&quot;)
if check.browser=&quot;IE&quot; and check.version >= &quot;4.0&quot; Then
checkbrowser = &quot;DropStyle&quot;
Else
checkbrowser = &quot;&quot;
End if
End function
%>

and remember to get rid of the i in brackets when you post!
[bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
Bug still there. The bug is not with the check browser function, it is with the following piece of cose further down:

<SCRIPT LANGUAGE=vbscript>
Sub ShowProduct
window.open &quot;/documents/products/images/&quot;+product_form.proName.value
End Sub
</SCRIPT>
 
<SCRIPT LANGUAGE=&quot;VBScript&quot;> where's the &quot;&quot; as little as it seems that may make a difference
Sub ShowProduct
window.open &quot;/documents/products/images/&quot;+product_form.proName.value
End Sub
</SCRIPT>

just curious, but why are you doing this client side?
is this a intranet?
[bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
Nope, I had tried the &quot;&quot; and that didn't make a difference.

Please excuse my ignorance, but how am I supposed to do it on the server side? Can the server force a new browser window on the client?

By the way, thanks for all the help....really appreciated.
 
why not just do this in javascript to correct
<SCRIPT>
function ShowProduct()
{
window.open(&quot;/documents/products/images/&quot; + product_form.proName.value
&quot;);
}
</SCRIPT>
[bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
Worked like a charm.....thanks so much!!!!
 
the way I wrote that will not work. sorry to misslead
this is how I would do it
<SCRIPT language=&quot;javascript&quot;>
function ShowProduct()
{
var box = document.form1.proName.value
var name = &quot;index&quot; + box + &quot;ext...&quot;
//the dir location is index
//box = the text value
//ext will be the extention to the file window,page if needed

window.alert(name);
//alert to test the name of the window then delete
window.open(name);
}
</SCRIPT> [bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
in that case forget the last post
glad I could help out [bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top