本文介绍了如何将标签值读取到javasript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在asp.net(c#)中做一个项目.下面的代码来自aspx page.这里的问题是我需要从label中删除的roomid.


flashvars.userid ="0";
flashvars.username ="shiva"; flashvars.roomid ="sqc7jm6";

例如:

flashvars.roomid ="sqc7jm6"


在Default.aspx.cs页面中,如果我显示的标签值为100,则在Default.aspx页面上它将显示为

flashvars.roomid ="100"


取决于标签值roomid要在aspx页上更改..请告诉我如何解决.....

i am doing a project in asp.net(c#).Below code is from aspx page.here my problem is roomid i have to chage from label.


flashvars.userid = "0";
flashvars.username="shiva"; flashvars.roomid = "sqc7jm6";

For Example:

flashvars.roomid="sqc7jm6"


Inside Default.aspx.cs page ,if i displaying label value is 100 then on Default.aspx page it will display like this

flashvars.roomid="100"


Depending upon label value roomid want to change on aspx page..please tell me how to solve it.....

推荐答案

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %>



<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Scribblar Room</title>
<LINK href="http://media.muchosmedia.com/brainwave/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://media.muchosmedia.com/scribblar/scripts/includes.js"></script>
<script type="text/javascript">


    var targetID = "scribblar";
    var flashvars = {};
////    /* pass necessary variables to the SWF */
    flashvars.userid = "0";
    flashvars.username = "shiva";


    flashvars.roomid = prompt("Enter Room Id");


  //  flashvars.roomid = "label1.Text";


                                /* the roomid for the room you'd like to access - substitute this for a valid roomid */
    flashvars.preferredLocales = "en_US";                           /* sets the language - if in doubt leave as en_US */
    /* optional: if you pass userid=0 you may also pass a username to skip the username prompt and log the
    user in using that username
    flashvars.username = "John";    */
    var params = {};
    params.allowscriptaccess = "always";
    var attributes = {};
    attributes.id = "scribblar";
    attributes.name = "scribblar";
    swfobject.embedSWF("http://media.muchosmedia.com/scribblar/v2/main.swf", "alternate", "80%", "80%", "10.2.0", "http://media.muchosmedia.com/swfobject/expressInstall.swf", flashvars, params, attributes);


</script>
</head>
<body scroll="no">

<div id="alternate">
<a href="http://www.adobe.com/go/getflashplayer">This page requires the latest version of Adobe Flash. Please download it now.<br>
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" border="0" alt="Get Adobe Flash Player" />
    </a>
</div>


</body>
</html>



并将此控件添加到aspx页面



and add this control to aspx page

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register src="WebUserControl.ascx" tagname="WebUserControl" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Scribblar Room</title>
<LINK href="http://media.muchosmedia.com/brainwave/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://media.muchosmedia.com/scribblar/scripts/includes.js"></script>

</head>
<body scroll="no">
    <form id="form1" runat="server">
<div id="alternate">
    <uc1:WebUserControl ID="WebUserControl1" runat="server" />
    <a href="http://www.adobe.com/go/getflashplayer"><br>
&nbsp;</a></div>
    <br />
    <!-- Codes by Quackit.com -->
<a href="javascript:location.reload(true)">Change RoomID</a>

    </form>
</body>
</html>


document.getElementByID("Control Id").Value = Some value


<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Scribblar Room</title>
<LINK href="http://media.muchosmedia.com/brainwave/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://media.muchosmedia.com/scribblar/scripts/includes.js"></script>
<script type="text/javascript">

    var targetID = "scribblar";
    var flashvars = {};
    /* pass necessary variables to the SWF */
    flashvars.userid = "0";
    flashvars.username = "shiva";
    flashvars.roomid = "sqc7jm6";


  //  flashvars.roomid = "label1.Text";


                                /* the roomid for the room you'd like to access - substitute this for a valid roomid */
    flashvars.preferredLocales = "en_US";                           /* sets the language - if in doubt leave as en_US */
    /* optional: if you pass userid=0 you may also pass a username to skip the username prompt and log the
    user in using that username
    flashvars.username = "John";    */
    var params = {};
    params.allowscriptaccess = "always";
    var attributes = {};
    attributes.id = "scribblar";
    attributes.name = "scribblar";
    swfobject.embedSWF("http://media.muchosmedia.com/scribblar/v2/main.swf", "alternate", "100%", "100%", "10.2.0", "http://media.muchosmedia.com/swfobject/expressInstall.swf", flashvars, params, attributes);
</script>
</head>
<body scroll="no">
    <form id="form1" runat="server">
<div id="alternate">
<a href="http://www.adobe.com/go/getflashplayer">This page requires the latest version of Adobe Flash. Please download it now.<br>
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" border="0" alt="Get Adobe Flash Player" />
    </a>
</div>
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    </form>
</body>
</html>








我的问题是

flashvars.roomid ="sqc7jm6";

这里roomid ="sqc7jm6";

我想从文本框中更改roomid ...如果我给roomid = 100,那么它将在aspx页面中显示Flashvars.roomid ="100",就像我想要的那种方法..

谢谢,
anoop








my problem is

flashvars.roomid = "sqc7jm6";

here roomid="sqc7jm6";

i want to chage roomid from textbox...if i give roomid =100 then it will show flashvars.roomid="100" in aspx page like that method i want.....

Thanks,
anoop


这篇关于如何将标签值读取到javasript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 23:33