Wednesday, March 21, 2012

web is not define or other error!

Default.master:

<head runat="server">
<asp:contentplaceholder runat="server" ID="ScriptIncludes">
<atlas:script ID="Script1" runat="server" Path="~/ScriptLibrary/AtlasCompat.js"
Browser="Mozilla" />
<atlas:script ID="Script2" runat="server" Path="~/ScriptLibrary/AtlasCompat.js"
Browser="Firefox" />
<atlas:script ID="Script3" runat="server" Path="~/ScriptLibrary/AtlasCompat.js"
Browser="AppleMAC-Safari" />
<atlas:script ID="Script4" runat="server" Path="~/ScriptLibrary/AtlasCore.js" />
<atlas:script ID="Script5" runat="server" Path="~/ScriptLibrary/AtlasCompat2.js"
Browser="AppleMAC-Safari" />
<atlas:Script ID="Script6" runat="server" Path="~/ScriptLibrary/AtlasRuntime.js"/>
<atlas:Script ID="Script7" runat="server" Path="~/ScriptLibrary/Atlas.js" />
</asp:contentplaceholder>
<link href="http://links.10026.com/?link=style.css" type="text/css" rel="Stylesheet" />
<asp:contentplaceholder runat="server" ID="Head" />
</head>

aspx:

<%@dotnet.itags.org. Page Language="C#" MasterPageFile="~/MyMain.master" Title="我的导航页" %>
<%@dotnet.itags.org. Import Namespace="System.Configuration" %>
<%@dotnet.itags.org. Import Namespace="System.Web.Security" %>
<%@dotnet.itags.org. Import Namespace="System.Data.SqlClient" %>
<%@dotnet.itags.org. Import Namespace="System.Web.Services" %>
<script runat="server">

[WebMethod]
public string ShowContent(string myId)
{
return myId;
}

</script>

....

<script type="text/javascript">
function showContent(id)
{
if(document.getElementById(id).style.display=="none")
{
//document.getElementById(id).innerHTML =
PageMethods.ShowContent(id,onComplete);
document.getElementById(id).style.display="";
}
else
{
document.getElementById(id).style.display="none";
}
}
function onComplete(ret)
{
document.getElementById(id).innerHTML = ret;
}
</script>
</asp:Content>

run is error:web is not define!

<script type="text/javascript"><!--var PageMethods = { ShowContent:function(myId,onMethodComplete, onMethodTimeout, onMethodError) {return Web.Net.PageMethodRequest.callMethod("ShowContent",{myId:myId}, onMethodComplete, onMethodTimeout, onMethodError); }}

if I write code to asmx,and i call it in aspx:

<script type="text/javascript" src="http://pics.10026.com/?src=AboutContent.asmx/js"></script>

<script type="text/javascript">
function showContent(id)
{
if(document.getElementById(id).style.display=="none")
{
//document.getElementById(id).innerHTML =
Samples.AspNet.AboutContent.ShowContent(id,onComplete);
document.getElementById(id).style.display="";
}
else
{
document.getElementById(id).style.display="none";
}
}
function onComplete(ret)
{
document.getElementById(id).innerHTML = ret;
}
</script>
</asp:Content>

run is error:

type is not define:

Type.registerNamespace('Samples.AspNet');
Samples is not define!
why?
please help me how to do!!
thanks !!!
 
In order to this question I did several weeks, helped me, did I have how to solve this problem?

I already solved this problem, extremely thank the time which but I like this did:

alert(Samples.AspNet.AboutContent.HelloWorld());

Returns:[object object]

I must like this write:

alert(Samples.AspNet.AboutContent.HelloWorld(onComplete));

...

function onComplete(ret)

{

alert(ret);

}

If I do not want to write: onComplete, do I have how to do only then can obtain WebService return value? Please advises, extremely thank


please help how to do!!

thanks!!


Now again has the similar problem pulls!

my code is:

var tdId = null;
function showContent(contentid)
{
//myid = "'"+myid+"'";
var aa = document.getElementById(contentid).style.display;
if(aa=="none")
{
tdId = contentid;

alert(tdId);//Here is correct
MyDream.AboutContent.ShowContent(contentid,onAComplete);
}
else
{
document.getElementById(contentid).style.display="none";
}
}

Yesterday all was good, how now again has the problem pulls? Why? May advise me? Extremely thank

No comments:

Post a Comment