Dynamically adding code

Results 1 to 2 of 2

Thread: Dynamically adding code

  1. #1
    Join Date
    Dec 1969

    Default Dynamically adding code

    I have a website where the content is added dynamically through the use of ASP and an MS Database. My problem is, however that I have a javascript mouseover menu that has items that should be dynamically added/removed in the same way.<BR><BR>Could anyone shine a light as to how I can write and delete javascript code to an existing script?<BR><BR>Thanks<BR><BR>Apologies if this is regarded as a non-ASP question.

  2. #2
    Join Date
    Dec 1969

    Default RE: Dynamically adding code

    If you are familiar with reading from a database and writing to the page, then you have everything that you need to write out javascript code.<BR><BR>&#060;script language="JavaScript"&#062;<BR>var arrMenus = new Array(&#060;%<BR> strSQL = "select fields from menustable"<BR> Set oRS = ConnectionObject.Execute(strSQL)<BR><BR> Do Until oRS.EOF Or Err.Number &#060;&#062; 0<BR> Response.Write "&#039;" & Replace(oRS("MenuName"), "&#039;", "&#039;") & "&#039;"<BR> oRS.MoveNext<BR><BR> If Not oRS.EOF Then Response.Write ","<BR> Loop<BR> %&#062;<BR>&#060;/script&#062;<BR><BR>It&#039;s a bit more tricky if the javascript is contained in a source file and you do:<BR>&#060;script language="Javascript" src="javascriptfile.js"&#062;&#060;/script&#062;<BR><BR>If you are doing that way, say so...<BR><BR>-Doug

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts