what the heck?!?!?!?

  • Thread starter Thread starter Paul W
  • Start date Start date
P

Paul W

ok - I've pissed away a morning on this. I keep getting a 'Server Tag is not
well formed' error on a page. I have simplified the page to the point of
ridiculous - and it still fails. The problem is related to the assignment to
'bightml2' in the JS.

If I change it to read "...runat="qqqqqq" then it works, but
"...runat="server" fails!!!!!

PLEASE can someone point me in the right direction?

Paul.
--
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb"
Inherits="ScheduleA.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/nav4-0"><script
language=javascript>
<!--
function testit(){


var bightml2
bightml2='style="WIDTH: 24px"type="text" size="1" value="1" name="txtNumber"
runat="server">'
alert (bightml)

}

//-->
</script>

</head>
<body MS_POSITIONING="FlowLayout">

<form id="Form1" method="post" runat="server">

</form>

</body>
</html>
 
This does not look right.

bightml2='style="WIDTH: 24px"type="text" size="1" value="1"
name="txtNumber"

There are extra quotes
 
you probably need to get the asp.net parser to stop looking at the literal
JS string.

Do that by breaking it up, and besides it doesn't make sense to output
"runat=server" on client side code!
 
when asp.net parses the html if it sees a runat=server, it expects to be
inside a valid tag. in this case its not so it gives the error. the fix is:

var bightml2 ='style="WIDTH: 24px"type="text" size="1" value="1"
name="txtNumber"
runat' + ' ="server">'

of course javascrip emitted html is only processed by the browser, so
runat=server is meanless. so you could just use:

var bightml2 ='style="WIDTH: 24px"type="text" size="1" value="1"
name="txtNumber" >'

-- bruce (sqlwork.com)
 
Thanks,

Paul.
Bruce Barker said:
when asp.net parses the html if it sees a runat=server, it expects to be
inside a valid tag. in this case its not so it gives the error. the fix
is:

var bightml2 ='style="WIDTH: 24px"type="text" size="1" value="1"
name="txtNumber"
runat' + ' ="server">'

of course javascrip emitted html is only processed by the browser, so
runat=server is meanless. so you could just use:

var bightml2 ='style="WIDTH: 24px"type="text" size="1" value="1"
name="txtNumber" >'

-- bruce (sqlwork.com)
 
Back
Top