473,396 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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="default.aspx.vb"
Inherits="mywebapp._default" %>
<HTML>
<HEAD>
<title>mycompany Sales Information System</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<LINK href="common.css" type="text/css" rel="stylesheet">
</HEAD>
<body text="#000000" bgColor="#ffffff">
<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"><IMG style="WIDTH: 572px; HEIGHT: 69px" height="69"
src="Images\mycompanyLogo.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="images/bg1.jpg" height="18">
<div class="links" align="center"><A class="links"
href="#"><FONT color="green">Home</FONT></A><FONT color="green">
|&nbsp; </FONT><A class="links" href="#"><FONT
color="green">FAQ</FONT></A><FONT color="green">
| </FONT><A class="links" href="#"><FONT
color="green">Contact</FONT></A></div>
</td>
</tr>
<tr>
<td height="43">&nbsp;
<asp:image id="Image1" runat="server" Width="160px"
ImageUrl="Images/mywebappLogo.bmp"></asp:image></td>
</tr>
</table>
</td>
</tr>
</table>
<P align="center"><STRONG><FONT face="Verdana" color="green">mycompany
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"><IMG height="100"
src="http://www.mywebsite.com/images/splash/fi_0904.jpg" width="200"></td>
<td style="WIDTH: 147px" width="147"><IMG height="100"
src="http://www.mywebsite.com/images/splash/am_0904.jpg" width="200"></td>
<td width="151"><IMG height="100"
src="http://www.mywebsite.com/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"><FONT 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="#ffffff" border="0">
<tr>
<td>
<table cellSpacing="0" cellPadding="0" width="100%"
border="0">
<tr>
<td width="46%"><span class="text">User ID</span></td>
<td width="54%">&nbsp;
<asp:textbox id="txtUser" runat="server"
CssClass="formfield"></asp:textbox></td>
</tr>
<tr>
<td class="text" width="46%">Password</td>
<td width="54%">&nbsp;
<asp:textbox id="txtPassword" runat="server"
CssClass="formfield" TextMode="Password"></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="botlinks" Font-Bold="True" ForeColor="White"
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="#ffffff" 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%">&nbsp;</td>
<td width="10%"><IMG height="16" src="images/braill.gif"
width="20"></td>
<td class="headlinks" width="80%"><A class="headlinks"
onmouseover="showit(0)" href="#">mycompany
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%">&nbsp;</td>
<td width="10%"><IMG height="16" src="images/braill.gif"
width="20"></td>
<td class="headlinks" width="80%"><A class="headlinks"
onmouseover="showit(1)" href="#">Industry
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="#d5dcdc" height="18">
<DIV id="describe" onmouseover="clear_delayhide()" style="WIDTH:
770px; HEIGHT: 14px; BACKGROUND-COLOR: #d5dcdc"
onmouseout="resetit(event)"></DIV>
<SCRIPT language="JavaScript1.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%">&nbsp;</td><td width="92%"><a
href="http://www.mycompany.com" class="links">mycompany</a> | <a
href="http://www.mycompanyle.com/" class="links">Law Enforcement</a> | <a
href="http://www.mycompanymilitary.com/" class="links">Military</a> | <a
href="http://www.rempac.org/" class="links">REMPAC</a> | <a
href="http://www.mycompanypmpd.com/" class="links">PMPD</a> | <a
href="http://www.mycompany.com/login/customer_login?NEXTURL=%2Fpartner%2Fdef
ault%2Ehtm" class="links">Partner</a> | </td></tr></table>'
submenu[1]='<table width="100%" border="0" cellspacing="0"
cellpadding="0"><tr><td width="23%">&nbsp;</td><td width="77%"><a
href="default.aspx?P=1" class="links">Organizational</a> | <a
href="default.aspx?P=2" class="links">Historical</a> | <a href="#"
class="links"><a href="default.aspx?P=3" class="links">Link1</a> | <a
href="default.aspx?P=4" class="links">Link2</a> | <a href="default.aspx?P=5"
class="links">Optics</a> | <a href="default.aspx?P=6"
class="links">Accessories</a> | <a href="default.aspx?P=8"
class="links">Hunting</a> | <a href="default.aspx?P=9"
class="links">Other</a> | <a href="default.aspx?P=10"
class="links">Sales</a></td></tr></table>'
submenu[2]='<table width="100%" border="0" cellspacing="0"
cellpadding="0"><tr><td width="61%">&nbsp;</td><td width="39%"><a href="#"
class="links">e-Signature Bill</a> | <a href="#" class="links">Digital
Document</a></td></tr></table>'
submenu[3]='<table width="100%" border="0" cellspacing="0"
cellpadding="0"><tr><td width="65%">&nbsp;</td><td width="35%"><a href="#"
class="links">News &amp; Events</a> | <a href="#" class="links">Policy
Alert</a> | <a href="#" class="links">Did 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=document.getElementById? document.getElementById("describe") :
document.all? document.all.describe : document.layers?
document.dep1.document.dep2 : ""

function showit(which){
clear_delayhide()
thecontent=(which==-1)? "" : submenu[which]
if (document.getElementById||document.all)
menuobj.innerHTML=thecontent
else if (document.layers){
menuobj.document.write(thecontent)
menuobj.document.close()
}
}

function resetit(e){
if (document.all&&!menuobj.contains(e.toElement))
delayhide=setTimeout("showit(-1)",delay_hide)
else if (document.getElementById&&e.currentTarget!= e.relatedTarget&&
!contains_ns6(e.currentTarget, e.relatedTarget))
delayhide=setTimeout("showit(-1)",delay_hide)
}

function clear_delayhide(){
if (window.delayhide)
clearTimeout(delayhide)
}

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="True"></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><FONT color="white">Home</FONT></U></A>
|&nbsp; <A class="botlinks" href="#"><U><FONT
color="white">FAQs</FONT></U></A>
| <A class="botlinks" href="#"><U><FONT color="white">Contact
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="<%=filename1%>" 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.com/images/splash/fi_" & testmonth &
filenameyear & ".jpg"
ammofname = "http://www.mycompany.com/images/splash/am_" & testmonth &
filenameyear & ".jpg"
accsfname = "http://www.mycompany.com/images/splash/ax_" & testmonth &
filenameyear & ".jpg"

I know the above works in ASP and in conjunction with the
src="<%=filename1%>" 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 2293
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*************@tk2msftngp13.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="default.aspx.vb"
Inherits="mywebapp._default" %>
<HTML>
<HEAD>
<title>mycompany Sales Information System</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<LINK href="common.css" type="text/css" rel="stylesheet">
</HEAD>
<body text="#000000" bgColor="#ffffff">
<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"><IMG style="WIDTH: 572px; HEIGHT: 69px" height="69"
src="Images\mycompanyLogo.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="images/bg1.jpg" height="18">
<div class="links" align="center"><A class="links"
href="#"><FONT color="green">Home</FONT></A><FONT color="green">
|&nbsp; </FONT><A class="links" href="#"><FONT
color="green">FAQ</FONT></A><FONT color="green">
| </FONT><A class="links" href="#"><FONT
color="green">Contact</FONT></A></div>
</td>
</tr>
<tr>
<td height="43">&nbsp;
<asp:image id="Image1" runat="server" Width="160px"
ImageUrl="Images/mywebappLogo.bmp"></asp:image></td>
</tr>
</table>
</td>
</tr>
</table>
<P align="center"><STRONG><FONT face="Verdana"
color="green">mycompany
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"><IMG height="100"
src="http://www.mywebsite.com/images/splash/fi_0904.jpg" width="200"></td>
<td style="WIDTH: 147px" width="147"><IMG height="100"
src="http://www.mywebsite.com/images/splash/am_0904.jpg" width="200"></td>
<td width="151"><IMG height="100"
src="http://www.mywebsite.com/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"><FONT 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="#ffffff" border="0">
<tr>
<td>
<table cellSpacing="0" cellPadding="0" width="100%"
border="0">
<tr>
<td width="46%"><span class="text">User ID</span></td>
<td width="54%">&nbsp;
<asp:textbox id="txtUser" runat="server"
CssClass="formfield"></asp:textbox></td>
</tr>
<tr>
<td class="text" width="46%">Password</td>
<td width="54%">&nbsp;
<asp:textbox id="txtPassword" runat="server"
CssClass="formfield" TextMode="Password"></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="botlinks" Font-Bold="True" ForeColor="White"
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="#ffffff" 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%">&nbsp;</td>
<td width="10%"><IMG height="16" src="images/braill.gif"
width="20"></td>
<td class="headlinks" width="80%"><A class="headlinks"
onmouseover="showit(0)" href="#">mycompany
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%">&nbsp;</td>
<td width="10%"><IMG height="16" src="images/braill.gif"
width="20"></td>
<td class="headlinks" width="80%"><A class="headlinks"
onmouseover="showit(1)" href="#">Industry
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="#d5dcdc" height="18">
<DIV id="describe" onmouseover="clear_delayhide()" style="WIDTH:
770px; HEIGHT: 14px; BACKGROUND-COLOR: #d5dcdc"
onmouseout="resetit(event)"></DIV>
<SCRIPT language="JavaScript1.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%">&nbsp;</td><td width="92%"><a
href="http://www.mycompany.com" class="links">mycompany</a> | <a
href="http://www.mycompanyle.com/" class="links">Law Enforcement</a> | <a
href="http://www.mycompanymilitary.com/" class="links">Military</a> | <a
href="http://www.rempac.org/" class="links">REMPAC</a> | <a
href="http://www.mycompanypmpd.com/" class="links">PMPD</a> | <a
href="http://www.mycompany.com/login/customer_login?NEXTURL=%2Fpartner%2Fdef
ault%2Ehtm" class="links">Partner</a> | </td></tr></table>'
submenu[1]='<table width="100%" border="0" cellspacing="0"
cellpadding="0"><tr><td width="23%">&nbsp;</td><td width="77%"><a
href="default.aspx?P=1" class="links">Organizational</a> | <a
href="default.aspx?P=2" class="links">Historical</a> | <a href="#"
class="links"><a href="default.aspx?P=3" class="links">Link1</a> | <a
href="default.aspx?P=4" class="links">Link2</a> | <a
href="default.aspx?P=5"
class="links">Optics</a> | <a href="default.aspx?P=6"
class="links">Accessories</a> | <a href="default.aspx?P=8"
class="links">Hunting</a> | <a href="default.aspx?P=9"
class="links">Other</a> | <a href="default.aspx?P=10"
class="links">Sales</a></td></tr></table>'
submenu[2]='<table width="100%" border="0" cellspacing="0"
cellpadding="0"><tr><td width="61%">&nbsp;</td><td width="39%"><a href="#"
class="links">e-Signature Bill</a> | <a href="#" class="links">Digital
Document</a></td></tr></table>'
submenu[3]='<table width="100%" border="0" cellspacing="0"
cellpadding="0"><tr><td width="65%">&nbsp;</td><td width="35%"><a href="#"
class="links">News &amp; Events</a> | <a href="#" class="links">Policy
Alert</a> | <a href="#" class="links">Did 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=document.getElementById? document.getElementById("describe") :
document.all? document.all.describe : document.layers?
document.dep1.document.dep2 : ""

function showit(which){
clear_delayhide()
thecontent=(which==-1)? "" : submenu[which]
if (document.getElementById||document.all)
menuobj.innerHTML=thecontent
else if (document.layers){
menuobj.document.write(thecontent)
menuobj.document.close()
}
}

function resetit(e){
if (document.all&&!menuobj.contains(e.toElement))
delayhide=setTimeout("showit(-1)",delay_hide)
else if (document.getElementById&&e.currentTarget!= e.relatedTarget&&
!contains_ns6(e.currentTarget, e.relatedTarget))
delayhide=setTimeout("showit(-1)",delay_hide)
}

function clear_delayhide(){
if (window.delayhide)
clearTimeout(delayhide)
}

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="True"></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><FONT color="white">Home</FONT></U></A>
|&nbsp; <A class="botlinks" href="#"><U><FONT
color="white">FAQs</FONT></U></A>
| <A class="botlinks" href="#"><U><FONT color="white">Contact
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="<%=filename1%>" 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.com/images/splash/fi_" & testmonth &
filenameyear & ".jpg"
ammofname = "http://www.mycompany.com/images/splash/am_" & testmonth &
filenameyear & ".jpg"
accsfname = "http://www.mycompany.com/images/splash/ax_" & testmonth &
filenameyear & ".jpg"

I know the above works in ASP and in conjunction with the
src="<%=filename1%>" 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*************@tk2msftngp13.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.HtmlControls.HtmlImage

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.com/images/splash/fi_{0:MMyy}.jpg",
DateTime.Now)
img2.Src =
String.Format("http://www.mywebsite.com/images/splash/am_{0:MMyy}.jpg",
DateTime.Now)
img3.Src =
String.Format("http://www.mywebsite.com/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
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...
8
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 -------------------------------------------------------------------------------- ...
1
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...
7
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...
9
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...
0
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...
4
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...
0
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...
9
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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,...

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.