473,756 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with a default page

I have the following default.aspx page that works properly.

However, what I want to do is to link the graphics within it (that are hard
coded now in the default web page) to our corporate website, which has the
same graphics rotated on a 30 day basis or so. They have a standard naming
convention where I know the 3 graphics are always going to be fa_mmyy.jpg,
am_mmyy.jpg, and ax_mmyy.jpg.

The HTML follows:

<%@ Page Language="vb" AutoEventWireup ="false" Codebehind="def ault.aspx.vb"
Inherits="myweb app._default" %>
<HTML>
<HEAD>
<title>mycompan y Sales Information System</title>
<meta content="Micros oft Visual Studio .NET 7.1" name="GENERATOR ">
<meta content="Visual Basic .NET 7.1" name="CODE_LANG UAGE">
<meta content="JavaSc ript" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
<LINK href="common.cs s" type="text/css" rel="stylesheet ">
</HEAD>
<body text="#000000" bgColor="#fffff f">
<form id="Form1" method="post" runat="server">
<table cellSpacing="0" cellPadding="0" width="770" align="left"
border="0">
<tr>
<td style="HEIGHT: 112px" vAlign="top" align="left" height="112">
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td width="353"><IM G style="WIDTH: 572px; HEIGHT: 69px" height="69"
src="Images\myc ompanyLogo.bmp" width="572"></td>
<td vAlign="top" align="left" width="270">
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td height="8"></td>
</tr>
<tr>
<td background="ima ges/bg1.jpg" height="18">
<div class="links" align="center"> <A class="links"
href="#"><FONT color="green">H ome</FONT></A><FONT color="green">
|&nbsp; </FONT><A class="links" href="#"><FONT
color="green">F AQ</FONT></A><FONT color="green">
| </FONT><A class="links" href="#"><FONT
color="green">C ontact</FONT></A></div>
</td>
</tr>
<tr>
<td height="43">&nb sp;
<asp:image id="Image1" runat="server" Width="160px"
ImageUrl="Image s/mywebappLogo.bm p"></asp:image></td>
</tr>
</table>
</td>
</tr>
</table>
<P align="center"> <STRONG><FONT face="Verdana" color="green">m ycompany
Arms Sales
Information System</FONT></STRONG>
</P>
</td>
</tr>
<tr>
<td>
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td style="WIDTH: 288px" width="288"><IM G height="100"
src="http://www.mywebsite.c om/images/splash/fi_0904.jpg" width="200"></td>
<td style="WIDTH: 147px" width="147"><IM G height="100"
src="http://www.mywebsite.c om/images/splash/am_0904.jpg" width="200"></td>
<td width="151"><IM G height="100"
src="http://www.mywebsite.c om/images/splash/ax_0904.jpg" width="200"></td>
<td vAlign="top" align="left" width="169" bgColor="green" >
<table cellSpacing="5" cellPadding="0" width="100%" border="0">
<tr>
<td class="heading" height="15"><FO NT color="#ffffff" >Member
Login</FONT></td>
</tr>
<tr>
<td>
<table cellSpacing="1" cellPadding="0" width="100%"
bgColor="green" border="0">
<tr>
<td>
<table height="114" cellSpacing="3" cellPadding="1"
width="100%" bgColor="#fffff f" border="0">
<tr>
<td>
<table cellSpacing="0" cellPadding="0" width="100%"
border="0">
<tr>
<td width="46%"><sp an class="text">Us er ID</span></td>
<td width="54%">&nb sp;
<asp:textbox id="txtUser" runat="server"
CssClass="formf ield"></asp:textbox></td>
</tr>
<tr>
<td class="text" width="46%">Pas sword</td>
<td width="54%">&nb sp;
<asp:textbox id="txtPassword " runat="server"
CssClass="formf ield" TextMode="Passw ord"></asp:textbox></td>
</tr>
</table>
<asp:label id="Msg" runat="server" CssClass="text"
Width="136px" ForeColor="Red" ></asp:label></td>
</tr>
<tr>
<td>
<div align="center"> <asp:button id="btnSubmit"
runat="server" CssClass="botli nks" Font-Bold="True" ForeColor="Whit e"
Text="Submit"></asp:button></div>
</td>
</tr>
<tr>
<td>
<div class="links" align="center"> <A class="links"
href="password. aspx">Change Password</A>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="HEIGHT: 18px" bgColor="#fffff f" height="18"></td>
</tr>
<tr>
<td bgColor="green" height="33">
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td width="300">
<table cellSpacing="6" cellPadding="0" width="100%" border="0">
<tr>
<td width="10%">&nb sp;</td>
<td width="10%"><IM G height="16" src="images/braill.gif"
width="20"></td>
<td class="headlink s" width="80%"><A class="headlink s"
onmouseover="sh owit(0)" href="#">mycomp any
Links</A></td>
</tr>
</table>
</td>
<td><IMG height="33" src="images/dit1.jpg" width="1"></td>
<td width="149">
<table cellSpacing="6" cellPadding="0" width="100%" border="0">
<tr>
<td width="10%">&nb sp;</td>
<td width="10%"><IM G height="16" src="images/braill.gif"
width="20"></td>
<td class="headlink s" width="80%"><A class="headlink s"
onmouseover="sh owit(1)" href="#">Indust ry
Links</A></td>
</tr>
</table>
</td>
<td><IMG height="33" src="images/dit1.jpg" width="1"></td>
<td width="149"></td>
<td><IMG height="33" src="images/dit1.jpg" width="1"></td>
<td width="169"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="1"></td>
</tr>
<tr>
<td bgColor="#d5dcd c" height="18">
<DIV id="describe" onmouseover="cl ear_delayhide() " style="WIDTH:
770px; HEIGHT: 14px; BACKGROUND-COLOR: #d5dcdc"
onmouseout="res etit(event)"></DIV>
<SCRIPT language="JavaS cript1.2">
var submenu=new Array()

//Set submenu contents. Expand as needed. For each content, make sure
everything exists on ONE LINE. Otherwise, there will be JS errors.

submenu[0]='<table width="100%" border="0" cellspacing="0"
cellpadding="0" ><tr><td width="8%">&nbs p;</td><td width="92%"><a
href="http://www.mycompany.c om" class="links">m ycompany</a> | <a
href="http://www.mycompanyle .com/" class="links">L aw Enforcement</a> | <a
href="http://www.mycompanymi litary.com/" class="links">M ilitary</a> | <a
href="http://www.rempac.org/" class="links">R EMPAC</a> | <a
href="http://www.mycompanypm pd.com/" class="links">P MPD</a> | <a
href="http://www.mycompany.c om/login/customer_login? NEXTURL=%2Fpart ner%2Fdef
ault%2Ehtm" class="links">P artner</a> | </td></tr></table>'
submenu[1]='<table width="100%" border="0" cellspacing="0"
cellpadding="0" ><tr><td width="23%">&nb sp;</td><td width="77%"><a
href="default.a spx?P=1" class="links">O rganizational</a> | <a
href="default.a spx?P=2" class="links">H istorical</a> | <a href="#"
class="links">< a href="default.a spx?P=3" class="links">L ink1</a> | <a
href="default.a spx?P=4" class="links">L ink2</a> | <a href="default.a spx?P=5"
class="links">O ptics</a> | <a href="default.a spx?P=6"
class="links">A ccessories</a> | <a href="default.a spx?P=8"
class="links">H unting</a> | <a href="default.a spx?P=9"
class="links">O ther</a> | <a href="default.a spx?P=10"
class="links">S ales</a></td></tr></table>'
submenu[2]='<table width="100%" border="0" cellspacing="0"
cellpadding="0" ><tr><td width="61%">&nb sp;</td><td width="39%"><a href="#"
class="links">e-Signature Bill</a> | <a href="#" class="links">D igital
Document</a></td></tr></table>'
submenu[3]='<table width="100%" border="0" cellspacing="0"
cellpadding="0" ><tr><td width="65%">&nb sp;</td><td width="35%"><a href="#"
class="links">N ews &amp; Events</a> | <a href="#" class="links">P olicy
Alert</a> | <a href="#" class="links">D id You Know?</a></td></tr></table>'
//Set delay before submenu disappears after mouse moves out of it (in
milliseconds)
var delay_hide=300

/////No need to edit beyond here

var menuobj=documen t.getElementByI d? document.getEle mentById("descr ibe") :
document.all? document.all.de scribe : document.layers ?
document.dep1.d ocument.dep2 : ""

function showit(which){
clear_delayhide ()
thecontent=(whi ch==-1)? "" : submenu[which]
if (document.getEl ementById||docu ment.all)
menuobj.innerHT ML=thecontent
else if (document.layer s){
menuobj.documen t.write(thecont ent)
menuobj.documen t.close()
}
}

function resetit(e){
if (document.all&& !menuobj.contai ns(e.toElement) )
delayhide=setTi meout("showit(-1)",delay_hid e)
else if (document.getEl ementById&&e.cu rrentTarget!= e.relatedTarget &&
!contains_ns6(e .currentTarget, e.relatedTarget ))
delayhide=setTi meout("showit(-1)",delay_hid e)
}

function clear_delayhide (){
if (window.delayhi de)
clearTimeout(de layhide)
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

</SCRIPT>
</td>
</tr>
<TR>
<TD height="18">
<table cellSpacing="0" cellPadding="0" width="770" align="center"
border="0">
<TR>
<TD>
<P>&nbsp;</P>
<P class="text" align="left">
<asp:Label id="Label2" runat="server" Width="694px"
CssClass="text" >The quota system is a new part of the mycompany managements
efforts to improve customer service. This system will provide the ability
to forecast at the sales class level. The tools provided include
forecasting at the customer level by inputting a percent improvement for
each of the business areas.</asp:Label></P>
<P class="text" align="center">
<asp:ListBox id="ListBox1" runat="server" Width="179px"
CssClass="text" DataTextField=" name"
DataValueField= "url" AutoPostBack="T rue"></asp:ListBox></P>
<P class="text" align="center"> <asp:label id="Label1"
runat="server" Width="304px"></asp:label></P>
<P>&nbsp;</P>
<P>&nbsp;</P>
</TD>
</TR>
</table>
<table cellSpacing="0" cellPadding="0" width="770" align="center"
border="0">
<TR>
<TD>
<DIV align="center"> <IMG height="2" src="images/hor_dot.gif"
width="652"></DIV>
</TD>
</TR>
<TR>
<TD height="6"></TD>
</TR>
<TR>
<TD bgColor="green" height="20">
<DIV class="botlinks " align="center"> <A class="botlinks "
href="#"><U><FO NT color="white">H ome</FONT></U></A>
|&nbsp; <A class="botlinks " href="#"><U><FO NT
color="white">F AQs</FONT></U></A>
| <A class="botlinks " href="#"><U><FO NT color="white">C ontact
Us</FONT></U></A></DIV>
</TD>
</TR>
<TR>
<TD height="20">
<DIV class="text" align="center"> Copyright 2004. All rights
reserved mycompany Arms</DIV>
</TD>
</TR>
</table>
</TD>
</TR>
</table>
</form>
</body>
</HTML>
What I want to do is the following:

Where the graphics on our corporate website are rotated each month, I want
to construct the filename within this page in order to be able to put the
month & year and develop a link to the corporate website that'd pull the
appropriate graphic over to it, keeping our sales site in synch with the
corporate one.

I kinda know how to do this in VBscript, and have an old ASP page that I
have tested with and know that the code I developed in VBscript is good and
does work like it should.

In my test, where I had the src=".... " statements on those graphics, I was
able to pull in the graphics from the main website, after building the
filename and putting together the URL for the graphic. I had something like
src="<%=filenam e1%>" and it worked.

However, this new page doesn't like the mixing of the VBscript with the
Javascript that's already on the page.

Is there a way for me to build the following in Javascript that'll work
within the page, and allow me to show those pictures and pull the new ones
as the month & year changes on the website.

testmonth = month(date)
testyear = year(date)
filenameyear = mid(testyear,3)
if testmonth < 10 then
testmonth = "0" & testmonth
end if

firearmsfname = "http://www.mycompany.c om/images/splash/fi_" & testmonth &
filenameyear & ".jpg"
ammofname = "http://www.mycompany.c om/images/splash/am_" & testmonth &
filenameyear & ".jpg"
accsfname = "http://www.mycompany.c om/images/splash/ax_" & testmonth &
filenameyear & ".jpg"

I know the above works in ASP and in conjunction with the
src="<%=filenam e1%>" in the src part of the IMG tag. However, I know
nothing about Javascript or how to write it or make it execute the same way
that the VBScript would.

How can I write the code above, put it into the html you see above that, and
have both to work?

Any help/advice appreciated,

SC

Nov 18 '05 #1
2 2317
ok, no one wants THAT much code... basically though you can get this and
pass it to the html with an asp:Label (which is easiest in my opinion)

<asp:Lable id=lblImage1 runat=server></asp:Image>

Then in the code-behind

lblImage1.Text = "<img src=http://www.server.com/ax_" +
System.DateTime .Now.Month + System.DateTime .Now.Year + ".jpg>";

You may have to wrap a small call around the Month & Year if you force 2
digits, but that's no biggie.

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Goober" <me@privacy.net > wrote in message
news:uV******** *****@tk2msftng p13.phx.gbl...
I have the following default.aspx page that works properly.

However, what I want to do is to link the graphics within it (that are
hard
coded now in the default web page) to our corporate website, which has the
same graphics rotated on a 30 day basis or so. They have a standard
naming
convention where I know the 3 graphics are always going to be fa_mmyy.jpg,
am_mmyy.jpg, and ax_mmyy.jpg.

The HTML follows:

<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="def ault.aspx.vb"
Inherits="myweb app._default" %>
<HTML>
<HEAD>
<title>mycompan y Sales Information System</title>
<meta content="Micros oft Visual Studio .NET 7.1" name="GENERATOR ">
<meta content="Visual Basic .NET 7.1" name="CODE_LANG UAGE">
<meta content="JavaSc ript" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
<LINK href="common.cs s" type="text/css" rel="stylesheet ">
</HEAD>
<body text="#000000" bgColor="#fffff f">
<form id="Form1" method="post" runat="server">
<table cellSpacing="0" cellPadding="0" width="770" align="left"
border="0">
<tr>
<td style="HEIGHT: 112px" vAlign="top" align="left" height="112">
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td width="353"><IM G style="WIDTH: 572px; HEIGHT: 69px" height="69"
src="Images\myc ompanyLogo.bmp" width="572"></td>
<td vAlign="top" align="left" width="270">
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td height="8"></td>
</tr>
<tr>
<td background="ima ges/bg1.jpg" height="18">
<div class="links" align="center"> <A class="links"
href="#"><FONT color="green">H ome</FONT></A><FONT color="green">
|&nbsp; </FONT><A class="links" href="#"><FONT
color="green">F AQ</FONT></A><FONT color="green">
| </FONT><A class="links" href="#"><FONT
color="green">C ontact</FONT></A></div>
</td>
</tr>
<tr>
<td height="43">&nb sp;
<asp:image id="Image1" runat="server" Width="160px"
ImageUrl="Image s/mywebappLogo.bm p"></asp:image></td>
</tr>
</table>
</td>
</tr>
</table>
<P align="center"> <STRONG><FONT face="Verdana"
color="green">m ycompany
Arms Sales
Information System</FONT></STRONG>
</P>
</td>
</tr>
<tr>
<td>
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td style="WIDTH: 288px" width="288"><IM G height="100"
src="http://www.mywebsite.c om/images/splash/fi_0904.jpg" width="200"></td>
<td style="WIDTH: 147px" width="147"><IM G height="100"
src="http://www.mywebsite.c om/images/splash/am_0904.jpg" width="200"></td>
<td width="151"><IM G height="100"
src="http://www.mywebsite.c om/images/splash/ax_0904.jpg" width="200"></td>
<td vAlign="top" align="left" width="169" bgColor="green" >
<table cellSpacing="5" cellPadding="0" width="100%" border="0">
<tr>
<td class="heading" height="15"><FO NT color="#ffffff" >Member
Login</FONT></td>
</tr>
<tr>
<td>
<table cellSpacing="1" cellPadding="0" width="100%"
bgColor="green" border="0">
<tr>
<td>
<table height="114" cellSpacing="3" cellPadding="1"
width="100%" bgColor="#fffff f" border="0">
<tr>
<td>
<table cellSpacing="0" cellPadding="0" width="100%"
border="0">
<tr>
<td width="46%"><sp an class="text">Us er ID</span></td>
<td width="54%">&nb sp;
<asp:textbox id="txtUser" runat="server"
CssClass="formf ield"></asp:textbox></td>
</tr>
<tr>
<td class="text" width="46%">Pas sword</td>
<td width="54%">&nb sp;
<asp:textbox id="txtPassword " runat="server"
CssClass="formf ield" TextMode="Passw ord"></asp:textbox></td>
</tr>
</table>
<asp:label id="Msg" runat="server" CssClass="text"
Width="136px" ForeColor="Red" ></asp:label></td>
</tr>
<tr>
<td>
<div align="center"> <asp:button id="btnSubmit"
runat="server" CssClass="botli nks" Font-Bold="True" ForeColor="Whit e"
Text="Submit"></asp:button></div>
</td>
</tr>
<tr>
<td>
<div class="links" align="center"> <A class="links"
href="password. aspx">Change Password</A>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="HEIGHT: 18px" bgColor="#fffff f" height="18"></td>
</tr>
<tr>
<td bgColor="green" height="33">
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td width="300">
<table cellSpacing="6" cellPadding="0" width="100%" border="0">
<tr>
<td width="10%">&nb sp;</td>
<td width="10%"><IM G height="16" src="images/braill.gif"
width="20"></td>
<td class="headlink s" width="80%"><A class="headlink s"
onmouseover="sh owit(0)" href="#">mycomp any
Links</A></td>
</tr>
</table>
</td>
<td><IMG height="33" src="images/dit1.jpg" width="1"></td>
<td width="149">
<table cellSpacing="6" cellPadding="0" width="100%" border="0">
<tr>
<td width="10%">&nb sp;</td>
<td width="10%"><IM G height="16" src="images/braill.gif"
width="20"></td>
<td class="headlink s" width="80%"><A class="headlink s"
onmouseover="sh owit(1)" href="#">Indust ry
Links</A></td>
</tr>
</table>
</td>
<td><IMG height="33" src="images/dit1.jpg" width="1"></td>
<td width="149"></td>
<td><IMG height="33" src="images/dit1.jpg" width="1"></td>
<td width="169"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="1"></td>
</tr>
<tr>
<td bgColor="#d5dcd c" height="18">
<DIV id="describe" onmouseover="cl ear_delayhide() " style="WIDTH:
770px; HEIGHT: 14px; BACKGROUND-COLOR: #d5dcdc"
onmouseout="res etit(event)"></DIV>
<SCRIPT language="JavaS cript1.2">
var submenu=new Array()

//Set submenu contents. Expand as needed. For each content, make sure
everything exists on ONE LINE. Otherwise, there will be JS errors.

submenu[0]='<table width="100%" border="0" cellspacing="0"
cellpadding="0" ><tr><td width="8%">&nbs p;</td><td width="92%"><a
href="http://www.mycompany.c om" class="links">m ycompany</a> | <a
href="http://www.mycompanyle .com/" class="links">L aw Enforcement</a> | <a
href="http://www.mycompanymi litary.com/" class="links">M ilitary</a> | <a
href="http://www.rempac.org/" class="links">R EMPAC</a> | <a
href="http://www.mycompanypm pd.com/" class="links">P MPD</a> | <a
href="http://www.mycompany.c om/login/customer_login? NEXTURL=%2Fpart ner%2Fdef
ault%2Ehtm" class="links">P artner</a> | </td></tr></table>'
submenu[1]='<table width="100%" border="0" cellspacing="0"
cellpadding="0" ><tr><td width="23%">&nb sp;</td><td width="77%"><a
href="default.a spx?P=1" class="links">O rganizational</a> | <a
href="default.a spx?P=2" class="links">H istorical</a> | <a href="#"
class="links">< a href="default.a spx?P=3" class="links">L ink1</a> | <a
href="default.a spx?P=4" class="links">L ink2</a> | <a
href="default.a spx?P=5"
class="links">O ptics</a> | <a href="default.a spx?P=6"
class="links">A ccessories</a> | <a href="default.a spx?P=8"
class="links">H unting</a> | <a href="default.a spx?P=9"
class="links">O ther</a> | <a href="default.a spx?P=10"
class="links">S ales</a></td></tr></table>'
submenu[2]='<table width="100%" border="0" cellspacing="0"
cellpadding="0" ><tr><td width="61%">&nb sp;</td><td width="39%"><a href="#"
class="links">e-Signature Bill</a> | <a href="#" class="links">D igital
Document</a></td></tr></table>'
submenu[3]='<table width="100%" border="0" cellspacing="0"
cellpadding="0" ><tr><td width="65%">&nb sp;</td><td width="35%"><a href="#"
class="links">N ews &amp; Events</a> | <a href="#" class="links">P olicy
Alert</a> | <a href="#" class="links">D id You Know?</a></td></tr></table>'
//Set delay before submenu disappears after mouse moves out of it (in
milliseconds)
var delay_hide=300

/////No need to edit beyond here

var menuobj=documen t.getElementByI d? document.getEle mentById("descr ibe") :
document.all? document.all.de scribe : document.layers ?
document.dep1.d ocument.dep2 : ""

function showit(which){
clear_delayhide ()
thecontent=(whi ch==-1)? "" : submenu[which]
if (document.getEl ementById||docu ment.all)
menuobj.innerHT ML=thecontent
else if (document.layer s){
menuobj.documen t.write(thecont ent)
menuobj.documen t.close()
}
}

function resetit(e){
if (document.all&& !menuobj.contai ns(e.toElement) )
delayhide=setTi meout("showit(-1)",delay_hid e)
else if (document.getEl ementById&&e.cu rrentTarget!= e.relatedTarget &&
!contains_ns6(e .currentTarget, e.relatedTarget ))
delayhide=setTi meout("showit(-1)",delay_hid e)
}

function clear_delayhide (){
if (window.delayhi de)
clearTimeout(de layhide)
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

</SCRIPT>
</td>
</tr>
<TR>
<TD height="18">
<table cellSpacing="0" cellPadding="0" width="770" align="center"
border="0">
<TR>
<TD>
<P>&nbsp;</P>
<P class="text" align="left">
<asp:Label id="Label2" runat="server" Width="694px"
CssClass="text" >The quota system is a new part of the mycompany
managements
efforts to improve customer service. This system will provide the ability
to forecast at the sales class level. The tools provided include
forecasting at the customer level by inputting a percent improvement for
each of the business areas.</asp:Label></P>
<P class="text" align="center">
<asp:ListBox id="ListBox1" runat="server" Width="179px"
CssClass="text" DataTextField=" name"
DataValueField= "url" AutoPostBack="T rue"></asp:ListBox></P>
<P class="text" align="center"> <asp:label id="Label1"
runat="server" Width="304px"></asp:label></P>
<P>&nbsp;</P>
<P>&nbsp;</P>
</TD>
</TR>
</table>
<table cellSpacing="0" cellPadding="0" width="770" align="center"
border="0">
<TR>
<TD>
<DIV align="center"> <IMG height="2" src="images/hor_dot.gif"
width="652"></DIV>
</TD>
</TR>
<TR>
<TD height="6"></TD>
</TR>
<TR>
<TD bgColor="green" height="20">
<DIV class="botlinks " align="center"> <A class="botlinks "
href="#"><U><FO NT color="white">H ome</FONT></U></A>
|&nbsp; <A class="botlinks " href="#"><U><FO NT
color="white">F AQs</FONT></U></A>
| <A class="botlinks " href="#"><U><FO NT color="white">C ontact
Us</FONT></U></A></DIV>
</TD>
</TR>
<TR>
<TD height="20">
<DIV class="text" align="center"> Copyright 2004. All rights
reserved mycompany Arms</DIV>
</TD>
</TR>
</table>
</TD>
</TR>
</table>
</form>
</body>
</HTML>
What I want to do is the following:

Where the graphics on our corporate website are rotated each month, I want
to construct the filename within this page in order to be able to put the
month & year and develop a link to the corporate website that'd pull the
appropriate graphic over to it, keeping our sales site in synch with the
corporate one.

I kinda know how to do this in VBscript, and have an old ASP page that I
have tested with and know that the code I developed in VBscript is good
and
does work like it should.

In my test, where I had the src=".... " statements on those graphics, I
was
able to pull in the graphics from the main website, after building the
filename and putting together the URL for the graphic. I had something
like
src="<%=filenam e1%>" and it worked.

However, this new page doesn't like the mixing of the VBscript with the
Javascript that's already on the page.

Is there a way for me to build the following in Javascript that'll work
within the page, and allow me to show those pictures and pull the new ones
as the month & year changes on the website.

testmonth = month(date)
testyear = year(date)
filenameyear = mid(testyear,3)
if testmonth < 10 then
testmonth = "0" & testmonth
end if

firearmsfname = "http://www.mycompany.c om/images/splash/fi_" & testmonth &
filenameyear & ".jpg"
ammofname = "http://www.mycompany.c om/images/splash/am_" & testmonth &
filenameyear & ".jpg"
accsfname = "http://www.mycompany.c om/images/splash/ax_" & testmonth &
filenameyear & ".jpg"

I know the above works in ASP and in conjunction with the
src="<%=filenam e1%>" in the src part of the IMG tag. However, I know
nothing about Javascript or how to write it or make it execute the same
way
that the VBScript would.

How can I write the code above, put it into the html you see above that,
and
have both to work?

Any help/advice appreciated,

SC

Nov 18 '05 #2
Hi,

"Goober" <me@privacy.net > wrote in message
news:uV******** *****@tk2msftng p13.phx.gbl...
<snip>

Set the <img> to be runat="server":

<IMG height="100" id="img1" runat="server" width="200">
<IMG height="100" id="img2" runat="server" width="200">
<IMG height="100" id="img3" runat="server" width="200">

If you're using the code-behind model declare references to them in the page
class:

Protected img1, img2, img3 As System.Web.UI.H tmlControls.Htm lImage

And then simply format the DateTime instance representing the current date
in Page_Load handler when IsPostBack is False:

If Not(IsPostBack) Then
img1.Src =
String.Format(" http://www.mywebsite.c om/images/splash/fi_{0:MMyy}.jpg ",
DateTime.Now)
img2.Src =
String.Format(" http://www.mywebsite.c om/images/splash/am_{0:MMyy}.jpg ",
DateTime.Now)
img3.Src =
String.Format(" http://www.mywebsite.c om/images/splash/ax_{0:MMyy}.jpg ",
DateTime.Now)
End If

You could, of course, set the src inline in the aspx page, but I don't like
the spaghetti code and I don't recommend it.

Have a look at the "Formatting Overview" topic in MSDN (in this particular
case we use custom DateTime format):
http://msdn.microsoft.com/library/en...ngoverview.asp

Hope this helps
Martin
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2071
by: PaulThomas | last post by:
Working with XP-Pro and VS.Net I have set my Start Page to "Home.aspx" but the application always starts the "Login" page - - - How can I change the start page to the Home.aspx??? On the login page that displays I have private void LinkButton1_Click(object sender, System.EventArgs e) { bool MyVar = true; Msg.Text = "ReDirecting to Home.aspx"; Response.Redirect("Home.aspx",MyVar); }
8
5478
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
1
1318
by: Andrew | last post by:
Hi, friends, I am following the "MS IIS 6.0 Deployment Guide" to deploy my asp.net application. However, I got completely lost in the session "Enabling Client Access IIS 6.0". It says: Enable client access to the ASP.NET applications on the Web server by completing the following steps: 1. Create the appropriate Domain Name System (DNS) entries for the ASP.NET
7
1249
by: Roshawn Dawson | last post by:
Hi, I have an xslt file located in the root directory. It is used by an aspx pages in both the root directory and a subdirectory. But for some strange reason, the aspx page in the subdirectory can neither locate the xslt file or the css file needed to get the desired results. What's the problem? Can anyone help me? Thanks, Roshawn
9
2191
by: KenLee | last post by:
I made an application which includes classic asp page and asp.net page. when I tried to redirect from classic asp page to asp.net 2.0 page, it works under my local IIS directory. ex) <a href="default.aspx?store=<%=rs("store")%>"><%=rs("store")%></a> However, When I copy that application into one of IIS directory in another intranet server, it doesn't work.
0
5573
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
4
1695
by: Guern1 | last post by:
Hi Need a bit of help here please to point me in the right direction. I have a java class file here which i wish from a menu item to open a web page which contains a help page. ] } else if (arg.equals(" Help Page")) { } else if (arg.equals("BrowserControl")) {
0
1909
by: magicofureyes | last post by:
Hello Guys im a just a new user and i dnt knw much abt Xml i want to upload a new template in Blogger so got some free coding but when i save this code in Blogger template it say '''' Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly. XML error message: The element type "Variable" must be terminated by the matching end-tag "". so please help me out and check this coding if...
9
2340
by: Jonathan Wood | last post by:
I've spent days trying to come up with a solution. I'd appreciate it if anyone can help. My site requires all users to log on. There are three different roles of users, and each user type will have access to a completely different set of pages. "Client" pages are in the root folder and "Admin" and "Trainer" pages each have their own subfolders. The problem is that when a user goes to the domain, I want to redirect "Admin" and...
0
9325
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9716
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9716
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9571
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8569
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6410
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4996
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2542
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.