Min endelige løsning blev dog at lave det hele fra Codebehind.
Her er min løsning hvis andre skulle få brug for det - kodet i ASP.NET og VB.NET
HTML:
<!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 runat="server">
<title>Slide Show</title>
</head>
<body>
<form id="form1" runat="server">
<img src="images/SlideShow/Frontpage/Do_Not_Delete.jpg" alt="SlideShow" name="slide" border="0" style="filter:blendTrans(duration=3)" />
</form>
</body>
</html>
Code Behind:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' Define the name and type of the client scripts on the page.
Dim csname1 As [String] = "PopupScript1"
Dim cstype1 As Type = Me.[GetType]()
' Get a ClientScriptManager reference from the Page class.
Dim cs1 As ClientScriptManager = Page.ClientScript
' Check to see if the startup script is already registered.
If Not cs1.IsStartupScriptRegistered(cstype1, csname1) Then
Dim cstext1 As New StringBuilder()
cstext1.Append("<script language='javascript' type='text/javascript'> var slidespeed=500")
cstext1.Append(" " & Environment.NewLine & " ")
cstext1.Append("var slideimages=new Array(" & SharedFunctions.GetSlideArray() & ")")
cstext1.Append(" " & Environment.NewLine & " ")
cstext1.Append("var slidelinks=new Array('
www.dynamicdrive.com','javascriptkit.com','
www.geocities.com')")
cstext1.Append(" " & Environment.NewLine & " ")
cstext1.Append("var imageholder=new Array()")
cstext1.Append(" " & Environment.NewLine & " ")
cstext1.Append("var ie=document.all")
cstext1.Append(" " & Environment.NewLine & " ")
cstext1.Append("for (i=0;i<slideimages.length;i++){")
cstext1.Append(" " & Environment.NewLine & " ")
cstext1.Append("imageholder[i]=new Image()")
cstext1.Append(" " & Environment.NewLine & " ")
cstext1.Append("imageholder[i].src=slideimages[i]")
cstext1.Append(" " & Environment.NewLine & " ")
cstext1.Append("}")
cstext1.Append(" " & Environment.NewLine & " ")
cstext1.Append("function gotoshow(){ ")
cstext1.Append(" " & Environment.NewLine & " ")
cstext1.Append("if (newwindow)")
cstext1.Append(" " & Environment.NewLine & " ")
cstext1.Append("window.open(slidelinks[whichlink])")
cstext1.Append(" " & Environment.NewLine & " ")
cstext1.Append("else")
cstext1.Append(" " & Environment.NewLine & " ")
cstext1.Append("window.location=slidelinks[whichlink] ")
cstext1.Append(" " & Environment.NewLine & " ")
cstext1.Append("} ")
cstext1.Append(" " & Environment.NewLine & " ")
'alert('Hello World!')")
cstext1.Append("</script>")
cs1.RegisterStartupScript(cstype1, csname1, cstext1.ToString())
End If
Dim csname2 As [String] = "PopupScript2"
Dim cstype2 As Type = Me.[GetType]()
' Get a ClientScriptManager reference from the Page class.
Dim cs2 As ClientScriptManager = Page.ClientScript
' Check to see if the startup script is already registered.
If Not cs2.IsStartupScriptRegistered(cstype2, csname2) Then
Dim cstext2 As New StringBuilder()
cstext2.Append("<script language='javascript' type='text/javascript'> var whichlink=0")
cstext2.Append(" " & Environment.NewLine & " ")
cstext2.Append("var whichimage=0")
cstext2.Append(" " & Environment.NewLine & " ")
cstext2.Append("var blenddelay=(ie)? document.images.slide.filters[0].duration*1000 : 0")
cstext2.Append(" " & Environment.NewLine & " ")
cstext2.Append("function slideit(){")
cstext2.Append(" " & Environment.NewLine & " ")
cstext2.Append("if (!document.images) return")
cstext2.Append(" " & Environment.NewLine & " ")
cstext2.Append("if (ie) document.images.slide.filters[0].apply()")
cstext2.Append(" " & Environment.NewLine & " ")
cstext2.Append("document.images.slide.src=imageholder[whichimage].src")
cstext2.Append(" " & Environment.NewLine & " ")
cstext2.Append("if (ie) document.images.slide.filters[0].play()")
cstext2.Append(" " & Environment.NewLine & " ")
cstext2.Append("whichlink=whichimage")
cstext2.Append(" " & Environment.NewLine & " ")
cstext2.Append("whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0")
cstext2.Append(" " & Environment.NewLine & " ")
cstext2.Append("setTimeout('slideit()',slidespeed+blenddelay)")
cstext2.Append(" " & Environment.NewLine & " ")
cstext2.Append("}")
cstext2.Append(" " & Environment.NewLine & " ")
cstext2.Append("slideit()")
cstext2.Append(" " & Environment.NewLine & " ")
cstext2.Append("</script>")
cs2.RegisterStartupScript(cstype2, csname2, cstext2.ToString())
End If
End Sub
Min SharedFunctions.vb:
Public Class SharedFunctions
Inherits System.Web.UI.Page
Public Shared Function GetSlideArray()
Dim i As Integer
Dim myFile As String
Dim ImageFolder As String
ImageFolder = System.Configuration.ConfigurationManager.AppSettings("FrontSlide")
Dim filesSlideShowImages() As String = IO.Directory.GetFiles(ImageFolder, "*.jpg")
'*** SlideShowImages
myFile = ""
For i = 0 To filesSlideShowImages.GetUpperBound(0)
Dim file As New System.IO.FileInfo(filesSlideShowImages(i))
If i = 0 Then
myFile = "'images/SlideShow/Frontpage/" & file.Name & "'"
Else
myFile = myFile + ",'images/SlideShow/Frontpage/" & file.Name & "'"
End If
Next
Return myFile
End Function
End Class