Dynamically add marquee tags and dynamically assign values and properties

Source: Internet
Author: User

Front loading JS

$ (function () {

var publishstr= "<%=publishtext%>"
var marqueestr= "<marquee id=\" marquee0\ "onmouseover=\" this.stop () \ "Onmouseout=\" This.start () \ "Direction=\" "+ direction+ "\" scrollamount=\ "" +scrollamount+ "\" scrolldelay=\ "" +scrolldelay+ "\" ></marquee> ";
$ ("#pulishText_div"). Append (MARQUEESTR);
$ ("#marquee0"). HTML (htmldecode(PUBLISHSTR));


For Publishtext, it is htmlencode encoded in the background.

Main interface-Announcements-scrolling content Settings

private void Noticedataget (string CustomerId)
String sql = string. Format (@ "select configname,src from dbo. Tvipmemebershipcenterconfig WHERE configcode= ' publishtext ' and status= ' 1 ' and [email protected] ");
var bllinfo = Unityinvoker.getbllinfo (CustomerId, dbkeys.biz);
Dbparameterlist paras = new dbparameterlist ();
paras. ADD ("@CustomerId", SqlDbType.VarChar, CustomerId); The
DataSet DataSet = Unityinvoker.bllinvoke<ibll_sqlhelper> (DATAINVOKEMODE.LANDRIECTDB).
Filldata (Bllinfo, Sql,paras);
DataTable dt = dataset.tables["fztable"];
if (dt! = null && dt. Rows.Count > 0)
foreach (DataRow dr in Dt. Rows)
Publishtext + = "<a href=\\\" "+ Httputility.htmlencode (dr[" SRC "]. Convertstring ()) + "\\\" > "+httputility.htmlencode (dr[" ConfigName "]) +" </a><br> ";
Else {
Publishtext + = "<a href=\\\" javascript:void (0) \\\ "> Announcement content, announcement content </a><br>";

So to show the existing notes, and through the encoded string, it is necessary to do special processing in the foreground, decoding HtmlDecode

function HtmlEncode (str) {

var ele = document.createelement (' div ');
Ele.appendchild (document.createTextNode (str));
return ele.innerhtml;

function HtmlDecode (str) {
var ele = document.createelement (' div ');
ele.innerhtml = str;
return ele;

Dynamically add marquee tags and dynamically assign values and properties

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.