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

Problem with getElementsById(ImgName).

3
Hi All

I could not display my image through this getElementsById(ImgName).Please let me what is wrong with this piece of code .I have stored all my images in the Doclib of sharepoint site.The last line of the code is throwing error also do let me know in case if we have any other alternate solutions to display my image.

Thanks
Jag



Expand|Select|Wrap|Line Numbers
  1. <span class="srch-Icon"> 
  2. <img alt="n1" id="{concat('IMG_',$id)}"  src="http://a2ms04866:3000/Pdfimage/_t/pdf%5Ficon%5Fsmall_gif.jpg" onmouseover ="javascript:cool1('{concat('IMG_',$id)}','{title}')"/>
  3.  
  4. <script language="javascript">
  5.  
  6. function cool()
  7. {
  8. alert("hii");
  9. }
  10.  
  11. function cool1(ImgName, Title)
  12. {
  13. alert(ImgName);
  14. alert(Title);
  15. var i=Title.indexOf(".");
  16. var xcv=Title.substring(0,i);
  17. var imagepath='http://a2ms04866:3000/Pdfimage/'+xcv+'.jpg';
  18. alert(imagepath);
  19. document.getElementsById(ImgName).src=imagepath;
  20. //alert(imagepath);
  21. }
  22.  
  23. </script>
Mar 19 '09 #1
3 3390
acoder
16,027 Expert Mod 8TB
The problem is that document.getElementsById() doesn't exist. It's document.getElementById() (without the 's'):
Expand|Select|Wrap|Line Numbers
  1. document.getElementById(ImgName).src=imagepath;
Mar 19 '09 #2
jags
3
thanks a lot and it worked for me !!

Regards
Jag
Mar 19 '09 #3
acoder
16,027 Expert Mod 8TB
No problem :) and welcome to Bytes! If you're new to JavaScript, you may want to check out the sticky at the top for useful links.
Mar 19 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ian Hardcastle | last post by:
I am creating a php script that I can call from a delphi program, this itself is easy as I have already done this. The problem lies within the php script, here is the code that DOESN'T work: <?...
1
by: Paul Weikel | last post by:
Can someone please tell me what the heck is wrong with my code here on line 59 and 60. i get an error that says object expected and I have NO understanding why. There must be something im...
3
by: richk | last post by:
For some reason when I add additional buttons a 3rd button and beyond i cant get the effect to work and I get errors...I cant understand why... <SCRIPT LANGUAGE = "javascript"><!-- if...
0
by: todorov-fkt | last post by:
Hello, I have packed a few images into resources files and compiled those files into a resource dll. The dll has a static function that returns all of the images. When I try to use the function...
5
by: comshiva | last post by:
Hi all, I have converted my existing ASP.NET project from 1.1 to 2.0 and i have found that everything works fine except the linkbutton control in my datagrid which throws an javascript error when...
0
by: Bo | last post by:
Can anyone explain why the code below inserts blank values into my access database while the same code without the masterpagefile reference works and inserts the values? <%@ Page Language="VB"...
2
by: Ed Jay | last post by:
I have n files sequentially named sitting on a server that I want to download to my local machine. file1.jpg file2.jpg file3.jpg The script downloads only the last file, e.g., in this...
1
by: linda.s | last post by:
I run the following code and got the error (I put a .gif file on the desktop) Traceback (most recent call last): File "11.py", line 25, in <module> for gifname in os.listdir(dirpath): OSError: ...
2
by: adamjblakey | last post by:
Hi, I need to use these 2 scripts together but for some reason when i try the first one does not work. Script 1 is a IE PnG Fix and Script 2 is a image slideshow. var arVersion =...
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...
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:
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
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
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...
0
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...

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.