Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. javascript for Random images pick

javascript for Random images pick

Scheduled Pinned Locked Moved ASP.NET
helpjavascriptdatabasesysadmindocker
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sivaram praveen
    wrote on last edited by
    #1

    in a page i need to pick an image randomly/sequencly n display it on the page so i have taken a javascript as below var num=1 img1 = new Image () img1.src = "images\BD\img1.jpg" img2 = new Image () img2.src = "images\BD\img2.jpg" function slideshowUp() { num=num+1 if (num==2) { num=1 } document.BD.src=eval("img"+num+".src") } i have an imag tag with this image tag i have kept the anchor tag to A HREF="JavaScript:slideshowUp()" asp:linkbutton id=Linkbutton3 runat="server" CssClass="Small" ForeColor="Blue" Text='<%# DataBinder.Eval(Container, "DataItem.Employee_Name") %>' /asp:linkbutton /A im getting the value of "DataItem.Employee_Name" from database table. but javascript is not working for LinkButton so pls help me in this issue?

    G 1 Reply Last reply
    0
    • S sivaram praveen

      in a page i need to pick an image randomly/sequencly n display it on the page so i have taken a javascript as below var num=1 img1 = new Image () img1.src = "images\BD\img1.jpg" img2 = new Image () img2.src = "images\BD\img2.jpg" function slideshowUp() { num=num+1 if (num==2) { num=1 } document.BD.src=eval("img"+num+".src") } i have an imag tag with this image tag i have kept the anchor tag to A HREF="JavaScript:slideshowUp()" asp:linkbutton id=Linkbutton3 runat="server" CssClass="Small" ForeColor="Blue" Text='<%# DataBinder.Eval(Container, "DataItem.Employee_Name") %>' /asp:linkbutton /A im getting the value of "DataItem.Employee_Name" from database table. but javascript is not working for LinkButton so pls help me in this issue?

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      sivaram praveen wrote:

      but javascript is not working

      That's not a useful description of the problem. What does it do, and how does that differ from what you expected? Do you get any error message? Why are you using a LinkButton? That will do a postback, so your javascript will never be called.

      Experience is the sum of all the mistakes you have done.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups