I have a piece of HTML code with Javascript tags which were working fine until i renamed the file .asp and added some asp code. The error I'm getting when loading up this page is
Now this was workign fine whne it was a .htm file but now I've added the VB script it fails.
heres the code
I'm absolutely stumped. I've googled it and have tried everything..... Any help or ideas on this would be fully appreciated!
Thanks
Mayoor
Code:
Active Server Pages error 'ASP 0138'
Nested Script Block
Line 12
A script block cannot be nested inside another script block
Now this was workign fine whne it was a .htm file but now I've added the VB script it fails.
heres the code
Code:
<% @LANGUAGE="VBSCRIPT" %>
<% Option Explicit %>
<html>
<head>
<title>Create/Edit Common Questions List Box </title>
<SCRIPT LANGUAGE="javascript">
// Set up standard global variables for the plugin
da = window.dialogArguments; // Scripting.Dictionary object - allows passing of parameters
support = da.Item("Support"); // Support object - used to access Immediacy functionality
siteurl = support.GetImageFolder()+"../";
document.write("<script language=\"javascript\" src=\""+siteurl+"plugins/plugin.js\"><\/script>");
var sStyle = da.Item("pStyle");
var PageLinkID = -1;
var arrPageIDs = Array("","","","","");
var arrPageNames = Array("","","","","");
function doOK(){
// Set the InnerHTML for the object - just to displayed something useful to the user
var sLinks = "";
var sLinksDisplay = "";
var intIDCounter = 0;
var intLinkCounter = 0;
//reset array
arrPageIDs = new Array();
arrPageNames = new Array();
//loop through form elements looking for the text boxes
for (var i = 0; i < document.forms[0].elements.length ; i++) {
if (document.forms[0].elements[i].type == "text"){
//if like pageLinkX
if (document.forms[0].elements[i].name.indexOf("pageLink") != -1 ){
//alert("name:" + document.forms[0].elements[i].name + " value" + document.forms[0].elements[i].value);
if (document.forms[0].elements[i].value != ""){
//alert("add value" + document.forms[0].elements[i].value);
arrPageNames[intLinkCounter] = document.forms[0].elements[i].value;
intLinkCounter++;
}
}
//else if like pageURLX
else if (document.forms[0].elements[i].name.indexOf("pageURL") != -1 ){
//alert("name:" + document.forms[0].elements[i].name + " value" + document.forms[0].elements[i].value);
if (document.forms[0].elements[i].value != ""){
//alert("add value" + document.forms[0].elements[i].value);
arrPageIDs[intIDCounter] = document.forms[0].elements[i].value;
intIDCounter++;
}
}
}
}
//loop through the id array becuase we have to have an id to create url
for (var i = 0; i < arrPageIDs.length ; i++) {
//check the user hasn't missed any steps
if (arrPageIDs[i] != ""){
sLinks = sLinks + arrPageIDs[i] + "^^" + arrPageNames[i] + "^^0||";
sLinksDisplay = sLinksDisplay + '<tr><td width="12"><a>> </a><br /></td><td>';
sLinksDisplay = sLinksDisplay + '<a href="' + arrPageIDs[i] + '">' + arrPageNames[i] + '</a><br /></td></tr>';
//alert("id " + arrPageIDs[i] + " name:" + arrPageNames[i])
}
}
if (sLinksDisplay != "") {
sLinksDisplay = '<br /><table class="list" border="0" cellpadding="0" cellspacing="0">' + sLinksDisplay + '</table>'
}
innerHTML = '<table class="' + sStyle + '" width="100%" border="0" cellpadding="0" cellspacing="0"><tr>';
innerHTML = innerHTML + '<td class="pad"><h2>' + topicListBox.txtBoxTitle.value + "</h2>";
innerHTML = innerHTML + topicListBox.txtBoxText.value + '<br />';
innerHTML = innerHTML + sLinksDisplay;
innerHTML = innerHTML + '</td></tr></table>';
//alert(innerHTML);
// Assign the values to the dictionary object
da.Item("pParams") = escape(sStyle) + ',' + escape(topicListBox.txtBoxTitle.value) + ',' + escape(topicListBox.txtBoxText.value) + ',' + escape(sLinks)
da.Item("pInnerHTML") = innerHTML;
// The return value must be set to true otherwise all edits will be lost
window.returnValue=true;
window.close();
}
function init(){
// Set a default return value - just in case the user click on the X
window.returnValue = false;
params = da.Item("pParams") + ""; // Variable used to store the parameters passed to the plugin
innerHTML = da.Item("pInnerHTML"); // Variable used to store the innerHTML of the plugin
if (params != "undefined"){
var arrParam = params.split(",");
topicListBox.txtBoxTitle.value = unescape(arrParam[1]);
topicListBox.txtBoxText.value = unescape(arrParam[2]);
var sTemp = unescape(arrParam[3]);
var arrTemp = sTemp.split("||");
for (var i = 0; i < arrTemp.length -1 ; i++){
var strTemp2 = arrTemp[i]
var arrTemp2 = strTemp2.split("^^")
arrPageIDs[i] = arrTemp2[0];
arrPageNames[i] = arrTemp2[1];
var tempObj
var n = 'pageLink' + (i + 1)
tempObj = eval("document.topicListBox." + n);
tempObj.value = arrPageNames[i];
n = 'pageURL' + (i + 1)
tempObj = eval("document.topicListBox." + n );
tempObj.value = arrPageIDs[i];
}
}
}
function doPageBrowse(itemNo)
{
var newpage = support.BrowsePage(PageLinkID);
//by using the eval function we can avoid having to name the input boxes explicitly
if (newpage != null)
{
var tempObj
//get the title
var n = 'pageLink' + (itemNo)
tempObj = eval("document.topicListBox." + n );
tempObj.value = newpage.Title;
//get the id/url
n = 'pageURL' + (itemNo)
tempObj = eval("document.topicListBox." + n );
tempObj.value = 'main.asp?page=' + newpage.PageID;
}
}
function doPageDelete(itemNo)
{
var tempObj
//get the title
var n = 'pageLink' + (itemNo)
tempObj = eval("document.topicListBox." + n );
tempObj.value = "";
//get the id/url
n = 'pageURL' + (itemNo)
tempObj = eval("document.topicListBox." + n );
tempObj.value = "";
}
</SCRIPT>
</head>
<body scroll=no onkeypress="document_onkeypress();" onLoad="init();">
<form id="topicListBox" name="topicListBox" method="post" action="DocumentPage.asp">
<!-- This table sets a margin around the entire form and causes the OK/Cancel buttons to automatically appear at a fix distance from the edge-->
<table cellpadding=0 cellspacing=5 border=0 height=100% width=100% ID="Table1">
<tr><td valign=top>
<fieldset>
<table cellpadding=2 cellspacing=2 border=0 ID="Table5">
<tr><td align="right">Box Title</td><td><input class="formfield" id="txtBoxTitle" size=50 type=text style="width:249;" NAME="txtBoxTitle"></input> </td></tr>
</table>
</fieldset>
<fieldset>
<table cellpadding=2 cellspacing=2 border=0 ID="Table5">
<tr><td align="right">Sub Title</td><td>
<input class="formfield" id="txtBoxSubTitle" size=50 type=text style="width:249;" NAME="txtBoxSubTitle"></input> </td></tr>
</table>
</fieldset>
<fieldset>
<table cellpadding=2 cellspacing=2 border=0 ID="Table5">
<tr>
<td align="left">Number of Headings</td><td>
<input
class="formfield"
id="txtHeadingOptions"
size=5
type=text
style="width:30;"
NAME="txtHeadingOptions">
</input>
<input
type="submit"
class="sbutton"
value="Update Options"
id="Button1"
name="Button1"
>
</td>
</tr>
</table>
</fieldset>
<fieldset>
<table cellpadding=2 cellspacing=2 border=0 ID="Table6">
<tr>
<td align="right">
Box Text
</td>
<td>
<textarea
class="formfield"
id="txtBoxText"
cols=100
rows=4
style="width:249;"
NAME="txtBoxText">
</textarea>
</td>
</tr>
</table>
</fieldset>
<%
Dim intHeadingOptions
intHeadingOptions = Request.Form("txtHeadingOptions")
%>
<fieldset>
<table cellpadding=3 border=0 cellspacing=2 ID="Table3">
<tr>
<td>Document Heading</td>
<td>URL or PageID</td>
</tr>
<%
Dim i
For i = 1 to intHeadingOptions
%>
<tr>
<td><input class="formfield"
name="pageLink<%=intHeadingOptions%>"
id="pageLink<%=intHeadingOptions%>"
maxlength="255"
size="20" type="text"
style="width:190;"
value="">
</td>
<td>
<input class="formfield"
name="pageURL<%=intHeadingOptions%>" id="pageURL<%=intHeadingOptions%>"
maxlength="255" size="20"
type="text"
style="width:190;" >
<input type="button"
class="sbutton"
value="Select"
id="Button<%=intHeadingOptions%>"
name="Button<%=intHeadingOptions%>"
onClick="doPageBrowse(<%=intHeadingOptions%>)">
<input type="button"
class="sbutton"
value="Delete"
id="btnDelete<%=intHeadingOptions%>"
name="btnDelete<%=intHeadingOptions%>"
onClick="doPageDelete(<%=intHeadingOptions%>)">
</td>
</tr>
<%
Next
%>
</table>
</fieldset>
</td></tr>
<tr><td valign=bottom align="right">
<input type="button" class="button" value="Ok" id="ok" name="ok" onClick="doOK()"> <input class="button" type="button" value="Cancel" id="cancel" name="cancel" onClick="window.returnValue=false;window.close();">
</td></tr></table>
</form>
</body>
</html>
I'm absolutely stumped. I've googled it and have tried everything..... Any help or ideas on this would be fully appreciated!
Thanks
Mayoor