
September 5th, 2003
08:23 AM
javascript & asp
Sorry this might be better in the Server side but im not sure. Anyway, using javascript i need to put a condition on a server variable from an asp recordset. This may make no sense cos Im clueless with JS but any help in the slightest would be a massive help.
Thanks
___________________
Please checkout my folio sites at Factory4.co.uk and z1ppy.deviantart.com

September 5th, 2003
08:30 AM
online since 96
Status: Offline!
I code in ASP, if you show some code I might be able to help out 
___________________
...a post by Tobias from 

September 5th, 2003
08:35 AM
<% varImage = rsProductsByCat.Fields.Item("imageavail").Value %>
<script language="JavaScript">
<!--
var jsVar = "<%= varImage %>";
if (jsVar == "true") { document.write("<img src="blah.jpg>") };
//-->
</script>

___________________
Please checkout my folio sites at Factory4.co.uk and z1ppy.deviantart.com

September 5th, 2003
08:44 AM
online since 96
Status: Offline!
Hmmm, are you trying to decide if there is an image in the DB and if so, post it!?
If that's the case, you don't need Javascript, you could just use:
<%
varImage = rsProductsByCat.Fields.Item("imageavail").Value
if varImage<>"" then
response.write "<img src="myImg.jpg">
end if
%>
Is that what you're trying to do here??? :confused:
___________________
...a post by Tobias from 

September 5th, 2003
08:56 AM
<% varImage = rsProductsByCat.Fields.Item("imageavail").Value %>
<script language="JavaScript">
<!--
var jsVar = "<%= varImage %>";
if (jsVar == "True") { document.write("<img src='../product_images/<%= rsProductsByCat.Fields.Item("RealID").Value %>.jpg' lowsrc='../lowsrc/<%= rsProductsByCat.Fields.Item("RealID").Value %>.gif' onMouseDown='MM_openBrWindow('productpix.asp?id=<%= rsProductsByCat.Fields.Item("RealID").Value %>','prodwin','width=400,height=400')' border='0' align='top'>") };
//-->
</script>
Yeah that was what i was trying to do but the above code actually works now. I could be wrong but I think it needed to be javascript because the site shopping cart was built in JS, it didnt work when we tried asp. Anyway many thanks for the help 
___________________
Please checkout my folio sites at Factory4.co.uk and z1ppy.deviantart.com

September 6th, 2003
09:40 AM
online since 96
Status: Offline!
Yea I figured it was some sorta "if the product has an image, show it" script 
Great you got it to work, but it should be able to work with just ASP as well 
___________________
...a post by Tobias from 