codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Get the image name  Solnyshko at 15:59 on Monday, May 19, 2008
 

I need to put the image name that was given in img tag into a form,or display it on the screen,help me please

  Re: Get the image name  o0DarkEvil0o at 21:41 on Monday, May 19, 2008
 

Functions:

function GetBaseName(file)
{
var Parts = file.split('\\');
if( Parts.length < 2 )Parts = file.split('/index.html');
return Parts[ Parts.length -1 ];
}
function getE(ID)
{
return document.getElementById(ID);
}
function getImgName(id, opt)
{
img=getE(id);
names=(opt==1)?GetBaseName(img.src):img.src;
return names;
}
function showname(id, todiv, opt)
{
divs=getE(todiv);
names=getImgName(id, opt);
divs.innerHTML=names;
}
</script>


HTML

<img src="/images/b.png" id="imgs">
<div id="showfull"></div>
<div id="showbase"></div>
<script>
showname("imgs", "showfull", 0); // show full name
showname("imgs", "showbase", 1); // show base name
</script>


  Re: Thanks  Solnyshko at 08:18 on Wednesday, May 21, 2008
 

o0DarkEvil0o,thank you!

  Re: Get the image name  o0DarkEvil0o at 11:14 on Wednesday, May 21, 2008
 

Don't mind! Your're welcome!








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: different image displayed based on screen resolution
•  new here, can anyone help me with a problem involving pointer?
•  Ask for suggestions on blog template :)
•  Re: Get the image name
•  A new simple way to make a image slider- Javascript Code
•  Re: convert minutes into hours and minutes
•  how to create forum on my own in java is it possible
•  Re: mkdirs
•  Help with recursion { recursive helper function }


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008