JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 4th, 2009, 06:36 AM
deeksha deeksha is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2009
Posts: 2 deeksha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 m 30 sec
Reputation Power: 0
Javascript function call from PHP

I am trying to call Javascript function from PHP code and it is not working.Any help is appreciated.

Thanks.

Reply With Quote
  #2  
Old November 4th, 2009, 04:07 PM
mecanicu mecanicu is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 115 mecanicu User rank is Private First Class (20 - 50 Reputation Level)mecanicu User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 6 h 29 m 6 sec
Reputation Power: 4
JavaScript is working on the client side and PHP on server side
For JavaScript to work on server side there is a lib which can be used (JSON)
You can find all you need here

all the best

Reply With Quote
  #3  
Old November 5th, 2009, 02:03 AM
deeksha deeksha is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2009
Posts: 2 deeksha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 m 30 sec
Reputation Power: 0
Javascript function to run on client side?

Thanks macanicu for your kind reply.I want the Javascript function to run on client side,as shown in the code:

<script type="text/javascript" language="javascript">
function change(name)
{
document.getElementById("but").src = document.getElementById(name).src;

}
</script>

<?
echo " <IMG src=\"$row[photopath]\" WIDTH=\"75\" HEIGHT=\"75\"
TITLE=\"Click to Enlarge\" id=\"$name\" onClick=\"change($name)\"/> ";
?>

Sorry for taking time of you.I am doing website for the first time.

Reply With Quote
  #4  
Old November 13th, 2009, 11:54 AM
mecanicu mecanicu is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 115 mecanicu User rank is Private First Class (20 - 50 Reputation Level)mecanicu User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 6 h 29 m 6 sec
Reputation Power: 4
Some tools for you

I don't see right now where your error is but there are some tools which are very useful in this development.
For the client size is firebug (you can find it here) and for the server part is firePHP (you can find it here)
In order to re-size your image you will want that the big image is downloaded only on click, so you Will need to send this request to the server which must know how to react on this
This can be done by submitting the page or by using AJAX technology (submit only needed part of the page). Some good tips on AJAX technology you can find here
A quick test for your function can be done with
PHP Code:
function change(name)
{
  
alert("I am here")
  
document.getElementById("but").src =  document.getElementById(name).src;

and than you will know that the function is "fired" if the alert box appears when you click the image. If the box isn't show than the function isn't run so the PHP part is wrong etc. etc.

Hope it helps

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Javascript function call from PHP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek