473,386 Members | 1,706 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,386 software developers and data experts.

using a javascript funtion with php

im crap with javascript, im not so hot with php, but anyway here's what
ive got

<script type="text/javascript">
var lay1=0
var lay2=0
function showpicture() {
lay2=0
if (lay1%2==0) {
document.getElementById("L1").style.display="block " } else {
document.getElementById("L1").style.display="none" }
document.getElementById("L2").style.display="none" lay1++
}
\
</script>

.....and inside a loop (looping through every item in a mysql database
<a href="#" onclick="showpicture(); return false">Show A
Picture Of This Product</a>
<div id="L1" style="display:none">
<a href="<?php echo ($picturepath); ?>"
target="LargeImage">
<img src="<?php echo ($picturepath); ?>"
height=200 alt='Image Of Product'> <font
size=2><br>Click The Image To See It Full
Size In A New Window</font>
</a>
</div>

$picture path is fine, because it worked before i had the javascript and i
just had <img src="<?php echo ($picturepath); ?>" height=200 alt='Image Of
Product'>

but that script only works the first time i click the "Show A Picture Of
This Product" hyperlink. if i press the same link further down, it doesn't
do anything, but the first time i click it on the page, it works for that
item (if that made any sence)

im trying to put a hyperlink (or a button, but hyperlink is easier) to
show a pictures for products only when the specific link is clicked. that
way it makes it possible to use scaled down images (so the man im writing
it for only has to upload one fullsize picture rather than two because he
wanted it hassle free)
does anybody have any idea how i could make it work how i want to?

thanks in advancee.
Jul 17 '05 #1
1 1579
$picture path is fine, because it worked before i had the javascript and


So this is a js question, not a php question. So please address a js group.

--
Fred H

void FredH::Contact() {
TextToSpeach.say("frode at age dee dee dot en oh");
}
Jul 17 '05 #2

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

Similar topics

4
by: Ziggi | last post by:
Hi. Is it possible to use PHP code within a javascript funtion? For example, is the following allowed... foo( <?php $_SERVER ?>); function foo { ... does something with string } Thanks...
14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
0
by: nic | last post by:
Hi, I need to get the equivilent of Response.Redirect (~/mypage.aspx) for a dynamic javascript function. Essentially I am writing the javascript on the non-code behind page and need to inject the...
9
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work...
6
by: Mantorok | last post by:
Hi I have a user control (ascx) and it has some javascript, however I want to use 3 instances of this control on my form - the problem is that the javascript functions are all being generated 3...
5
by: Lee Xuzhang | last post by:
/* from SICP -- Exercise 4.21: ((lambda (n) ((lambda (fact) (fact fact n)) (lambda (ft k) (if (= k 1) 1 (* k (ft ft (- k 1))))))) 10) */
6
by: pronerd | last post by:
Hi, I am trying to dynamically set an event handler across frames. I have no problems setting properties across frames doing something like parent.ToolMenuFrame.location.href =...
8
by: nkoriginal | last post by:
Hi: (this is a dummy question, I know, but I tried many times and I cant) I need to insert this javascript option inside the input, I can't insert any funtion in <head> I've this two...
2
by: wolverine2512 | last post by:
Hello .Net Wizards! I would like to seek your help on how to call javascript function from code behind of VB.net. I have javascript function named Openform() and i want to execute it on page load,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.